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 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(). 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. 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. 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? 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? 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. 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. >_< 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
Archived
This topic is now archived and is closed to further replies.