count characters in php string code example
Example 1: 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
?>
Example 2: counting a string in php
strlen('your strings here!');