3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function substr_count_array( $haystack, $needle ) { $count = 0; foreach ($needle as $substring) { $count += substr_count( $haystack, $substring); } return $count; } $str = 'The fox jumped over the table and ate a frog'; $search = 'fox ate frog'; echo substr_count_array($str, explode(' ', $search));
Output for 4.3.0 - 7.1.7
3