3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $mlbCities = array( 'Carolina', 'Atlanta', 'New Orleans', 'Philadelphia', 'St. Louis', 'Washington', 'Houston', 'Tennessee', 'New England', 'NY Jets', 'Cincinnati', 'Green Bay', 'Arizona', 'Jacksonville', 'Oakland', 'Kansas City', 'Minnesota', 'Detroit', 'Tampa Bay', 'Buffalo', 'Seattle', 'San Francisco', 'Pittsburgh', 'Chicago', 'Baltimore', 'San Diego', 'Cleveland', 'Denver', 'NY Giants', 'Dallas', 'Indianapolis', 'Miami' ); $string = 'San Francisco Giants'; foreach($mlbCities as $city) { $fl_array[] = preg_grep("/{$city}/", $string); } var_dump($fl_array); ?>
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 array(32) { [0]=> NULL [1]=> NULL [2]=> NULL [3]=> NULL [4]=> NULL [5]=> NULL [6]=> NULL [7]=> NULL [8]=> NULL [9]=> NULL [10]=> NULL [11]=> NULL [12]=> NULL [13]=> NULL [14]=> NULL [15]=> NULL [16]=> NULL [17]=> NULL [18]=> NULL [19]=> NULL [20]=> NULL [21]=> NULL [22]=> NULL [23]=> NULL [24]=> NULL [25]=> NULL [26]=> NULL [27]=> NULL [28]=> NULL [29]=> NULL [30]=> NULL [31]=> NULL }
Output for hhvm-3.12.0
Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 Warning: preg_grep() expects parameter 2 to be array, string given in /in/PntVk on line 40 array(32) { [0]=> NULL [1]=> NULL [2]=> NULL [3]=> NULL [4]=> NULL [5]=> NULL [6]=> NULL [7]=> NULL [8]=> NULL [9]=> NULL [10]=> NULL [11]=> NULL [12]=> NULL [13]=> NULL [14]=> NULL [15]=> NULL [16]=> NULL [17]=> NULL [18]=> NULL [19]=> NULL [20]=> NULL [21]=> NULL [22]=> NULL [23]=> NULL [24]=> NULL [25]=> NULL [26]=> NULL [27]=> NULL [28]=> NULL [29]=> NULL [30]=> NULL [31]=> NULL }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.11 - 5.1.6
Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: preg_grep(): Second argument to preg_grep() should be an array in /in/PntVk on line 40 array(32) { [0]=> NULL [1]=> NULL [2]=> NULL [3]=> NULL [4]=> NULL [5]=> NULL [6]=> NULL [7]=> NULL [8]=> NULL [9]=> NULL [10]=> NULL [11]=> NULL [12]=> NULL [13]=> NULL [14]=> NULL [15]=> NULL [16]=> NULL [17]=> NULL [18]=> NULL [19]=> NULL [20]=> NULL [21]=> NULL [22]=> NULL [23]=> NULL [24]=> NULL [25]=> NULL [26]=> NULL [27]=> NULL [28]=> NULL [29]=> NULL [30]=> NULL [31]=> NULL }
Output for 4.3.0 - 4.3.10
Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 Warning: Second argument to preg_grep() should be an array in /in/PntVk on line 40 array(32) { [0]=> NULL [1]=> NULL [2]=> NULL [3]=> NULL [4]=> NULL [5]=> NULL [6]=> NULL [7]=> NULL [8]=> NULL [9]=> NULL [10]=> NULL [11]=> NULL [12]=> NULL [13]=> NULL [14]=> NULL [15]=> NULL [16]=> NULL [17]=> NULL [18]=> NULL [19]=> NULL [20]=> NULL [21]=> NULL [22]=> NULL [23]=> NULL [24]=> NULL [25]=> NULL [26]=> NULL [27]=> NULL [28]=> NULL [29]=> NULL [30]=> NULL [31]=> NULL }