3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array( array('james','Brandun','test'), array('james0','Brandun0','test0'), array('james1','Brandun1','test1') ); function displayLocation( $array, $position){ foreach ($array as $subArray) { $value = $subArray[$position]; array_push($anotherArray,$value); } return $anotherArray; } $temp = displaylocation($array,0); print_r($temp); ?>
based on 5ePib
Output for 5.3.0 - 7.2.0
Warning: array_push() expects parameter 1 to be array, null given in /in/RYBJh on line 14 Warning: array_push() expects parameter 1 to be array, null given in /in/RYBJh on line 14 Warning: array_push() expects parameter 1 to be array, null given in /in/RYBJh on line 14
Output for 4.3.2 - 5.2.17
Warning: array_push(): First argument should be an array in /in/RYBJh on line 14 Warning: array_push(): First argument should be an array in /in/RYBJh on line 14 Warning: array_push(): First argument should be an array in /in/RYBJh on line 14
Output for 4.3.0 - 4.3.1
Warning: array_push() [http://www.php.net/function.array-push]: First argument should be an array in /in/RYBJh on line 14 Warning: array_push() [http://www.php.net/function.array-push]: First argument should be an array in /in/RYBJh on line 14 Warning: array_push() [http://www.php.net/function.array-push]: First argument should be an array in /in/RYBJh on line 14