3v4l.org

run code in 300+ PHP versions simultaneously
<?php $colors = array('black','yellow','red'); $color = 'reddish'; $string = implode(' ', $colors); echo substr_count($string, $color);

preferences:
36.58 ms | 402 KiB | 5 Q