Assuming I have an array of colors:
$colors = array('black','yellow','red');
$color = 'reddish';
How can I calculate the number of occurrence of them? Because substr_count() may be well detecting 'red', but 'reddish' won't be included. So I need to match the string precisely despite what's before or after it.
$string = implode(' ', $colors);
echo substr_count($string, $color);
reddishto be a match or not? I don't understand.9@)redV_%1bm. Anythingsubstr_countdoes...black yellow redin the stringreddishhence it is not a match