如何在字符串中找到3个或更多字符? [重复]

This question already has an answer here:

$string = "oidjdssd , odi,jdois, 3089u,, oisdjsd";

How do i find out if theres more than 3 commas in the string above in the best way?

</div>

I would suggest substr_count. You can see if the result is >3 to see if there's more than three.

echo count_chars($string)[ord(',')];

Or for PHP<5.4

$chars = count_chars($string);
echo $chars[ord(',')];

BTW: As it seems, that you are handling CSV-data, you should have a look at str_getcsv()