occurrence of character in string in php code example
Example: php count specific characters in string
<?php
//you can use the substr_count function
$str = "this is a test string";
echo substr_count($str, "s"); //Output: 4
?>
<?php
//you can use the substr_count function
$str = "this is a test string";
echo substr_count($str, "s"); //Output: 4
?>