Uncannytable Posted July 8, 2006 Share Posted July 8, 2006 What is the command for counting the number of times a letter appears on a string? Quote Link to comment https://forums.phpfreaks.com/topic/14030-i-need-help/ Share on other sites More sharing options...
Kurt Posted July 8, 2006 Share Posted July 8, 2006 Use substr_count($string,"Text to search for"). Example:[code]$count=substr_count('Phpfreaks rocks!','p');echo $count;//outputs 2[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14030-i-need-help/#findComment-54813 Share on other sites More sharing options...
Uncannytable Posted July 9, 2006 Author Share Posted July 9, 2006 Thanks.it helped a lot. Quote Link to comment https://forums.phpfreaks.com/topic/14030-i-need-help/#findComment-55102 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.