Jump to content

Count occurrences of a substring: Difference between revisions

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}}: Using PHP_EOL makes your code portable. It is translated to "\n", "\r\n" or "\r" depending on your OS.)
Line 1,929:
=={{header|PHP}}==
<lang php><?php
echo substr_count("the three truths", "th"), "\n"PHP_EOL; // prints "3"
echo substr_count("ababababab", "abab"), "\n"PHP_EOL; // prints "2"
?></lang>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.