Count occurrences of a substring: Difference between revisions
Content added Content deleted
m (→{{header|PHP}}: Using PHP_EOL makes your code portable. It is translated to "\n", "\r\n" or "\r" depending on your OS.) |
m (→{{header|PHP}}: Avoiding "?>" at the end of your source file makes extra whitespace to appear less likely.) |
||
Line 1,931: | Line 1,931: | ||
echo substr_count("the three truths", "th"), PHP_EOL; // prints "3" |
echo substr_count("the three truths", "th"), PHP_EOL; // prints "3" |
||
echo substr_count("ababababab", "abab"), PHP_EOL; // prints "2" |
echo substr_count("ababababab", "abab"), PHP_EOL; // prints "2" |
||
</lang> |
|||
=={{header|PicoLisp}}== |
=={{header|PicoLisp}}== |