How to count string characters in PHP? <?php //you can use the substr_count function $str = "this is a test string"; echo substr_count($str, "s"); //Output: 4 ?> Curly hair, very fair, please share :)Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window)Click to share on Reddit (Opens in new window)Click to share on Telegram (Opens in new window)Click to share on WhatsApp (Opens in new window)Click to email a link to a friend (Opens in new window) Subash Chandran 7th November 2021 Leave a Comment