3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = 'key1'; $testArray = array ( 'subArray1' => array( 'key1' => "Sub array 1 value 1", 'key2' => "Sub array 1 value 1" ), 'subArray2' => array( 'key1' => "Sub array 2 value 1", 'key2' => "Sub array 2 value 2" ) ); $output = array_column($testArray, $key); var_dump($output); var_dump(array_combine(array_keys($testArray), array_column($testArray, $key)));
Output for 5.5.24 - 7.2.6
array(2) { [0]=> string(19) "Sub array 1 value 1" [1]=> string(19) "Sub array 2 value 1" } array(2) { ["subArray1"]=> string(19) "Sub array 1 value 1" ["subArray2"]=> string(19) "Sub array 2 value 1" }
Output for 5.0.0 - 5.4.45
Fatal error: Call to undefined function array_column() in /in/Uh8Xc on line 16
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_column() in /in/Uh8Xc on line 16
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_column() in /in/Uh8Xc on line 16
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_column() in /in/Uh8Xc on line 16