retoto Posted November 12, 2007 Share Posted November 12, 2007 i need function ( if have ) to count how mach "a" or somthing else have in word like in "bssdfb" so if want count "b" and i echo funcion i will see 2... thanks for the help Link to comment https://forums.phpfreaks.com/topic/77037-solved-have-function-for-count/ Share on other sites More sharing options...
centerwork Posted November 12, 2007 Share Posted November 12, 2007 You need to use preg_match(). Here is a link to get more information on it. http://us2.php.net/manual/en/function.preg-match.php Link to comment https://forums.phpfreaks.com/topic/77037-solved-have-function-for-count/#findComment-390119 Share on other sites More sharing options...
Barand Posted November 12, 2007 Share Posted November 12, 2007 or www.php.net/substr_count Link to comment https://forums.phpfreaks.com/topic/77037-solved-have-function-for-count/#findComment-390122 Share on other sites More sharing options...
retoto Posted November 12, 2007 Author Share Posted November 12, 2007 thanks man!!! helper Link to comment https://forums.phpfreaks.com/topic/77037-solved-have-function-for-count/#findComment-390125 Share on other sites More sharing options...
Barand Posted November 12, 2007 Share Posted November 12, 2007 There are half a dozen examples on that page. Link to comment https://forums.phpfreaks.com/topic/77037-solved-have-function-for-count/#findComment-390127 Share on other sites More sharing options...
Orio Posted November 12, 2007 Share Posted November 12, 2007 You can use count_chars() which will return how many times each char appears. You can also use substr_count() without the two optional parameters. Of course, you can use preg_match_all() and stuff like that, but these two functions will get you your results much faster. Orio. Link to comment https://forums.phpfreaks.com/topic/77037-solved-have-function-for-count/#findComment-390128 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.