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 Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Barand Posted November 12, 2007 Share Posted November 12, 2007 or www.php.net/substr_count Quote Link to comment Share on other sites More sharing options...
retoto Posted November 12, 2007 Author Share Posted November 12, 2007 thanks man!!! helper Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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.