liamthebof Posted August 7, 2008 Share Posted August 7, 2008 Is there a way to count the number of a particular character in a strin, in this casse, counting all the -'s (dashes). Thanks Quote Link to comment https://forums.phpfreaks.com/topic/118541-solved-count-a-particular-character/ Share on other sites More sharing options...
trq Posted August 7, 2008 Share Posted August 7, 2008 count_chars(). Quote Link to comment https://forums.phpfreaks.com/topic/118541-solved-count-a-particular-character/#findComment-610293 Share on other sites More sharing options...
liamthebof Posted August 7, 2008 Author Share Posted August 7, 2008 My god, how easy. I tried googling but the best I could find was about mySQL. Thanks Thorpe. Quote Link to comment https://forums.phpfreaks.com/topic/118541-solved-count-a-particular-character/#findComment-610294 Share on other sites More sharing options...
trq Posted August 7, 2008 Share Posted August 7, 2008 I tried googling but the best I could find was about mySQL. This is where learning to use the manual comes in handy. I wasn't exactly sure of the name of the file but simply went to the 'Text Manipulation' section and browsed. Actually, substr_count is probably of more use to you. Quote Link to comment https://forums.phpfreaks.com/topic/118541-solved-count-a-particular-character/#findComment-610295 Share on other sites More sharing options...
DarkWater Posted August 7, 2008 Share Posted August 7, 2008 You just posted the same function, Thorpe. o-O Did you mean to post another one? Quote Link to comment https://forums.phpfreaks.com/topic/118541-solved-count-a-particular-character/#findComment-610296 Share on other sites More sharing options...
discomatt Posted August 7, 2008 Share Posted August 7, 2008 count_chars(). Actually, substr_count is probably of more use to you. You just posted the same function, Thorpe. o-O Did you mean to post another one? Huh? Quote Link to comment https://forums.phpfreaks.com/topic/118541-solved-count-a-particular-character/#findComment-610297 Share on other sites More sharing options...
trq Posted August 7, 2008 Share Posted August 7, 2008 Nah.... I had editing issues. Shouldn't play with the edit button after someone has replied. Quote Link to comment https://forums.phpfreaks.com/topic/118541-solved-count-a-particular-character/#findComment-610299 Share on other sites More sharing options...
DarkWater Posted August 7, 2008 Share Posted August 7, 2008 xD No problem. >_< Quote Link to comment https://forums.phpfreaks.com/topic/118541-solved-count-a-particular-character/#findComment-610313 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.