3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = 'maríaé'; function substr_count_array( $haystack, $needle ) { $count = 0; foreach ($needle as $substring) { $count[$substring] += substr_count( $haystack, $substring); } return $count; } print_r(substr_count_array($str, array("á","é","í","ó")));
based on RQS91
Output for 4.3.0 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Warning: Cannot use a scalar value as an array in /in/7siHP on line 6 Warning: Cannot use a scalar value as an array in /in/7siHP on line 6 Warning: Cannot use a scalar value as an array in /in/7siHP on line 6 Warning: Cannot use a scalar value as an array in /in/7siHP on line 6 0
Output for 5.0.0 - 5.0.1
Warning: Cannot use a scalar value as an array in /in/7siHP on line 6
Process exited with code 139.