PHP Counting Occurrences Of Substring – String Function

<?php
$counter = substr_count ("Hello World!","o"); echo "There are " . $counter . " instance (s) of \"o\" in Hello World!.";
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.