Counting the Occurrences of a Substring : substr_count « String « PHP
- PHP
- String
- substr_count
Counting the Occurrences of a Substring
<?php
$counter = substr_count ("Hello World!","o");
echo "There are " . $counter . " instance (s) of \"o\" in Hello World!.";
?>
Related examples in the same category