3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rows=[["id"=>42.5,"val"=>"E"],["id"=>42,"val"=>"A"]]; var_export(array_column($rows,"val","id"));
Output for 8.1.34, 8.2.27 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Deprecated: Implicit conversion from float 42.5 to int loses precision in /in/Sa6Wn on line 3 array ( 42 => 'A', )
Output for 7.4.33
array ( 42 => 'A', )
Output for 5.5.38
array ( 0 => 'E', 42 => 'A', )
Output for 5.4.45
Fatal error: Call to undefined function array_column() in /in/Sa6Wn on line 3
Process exited with code 255.

preferences:
64.1 ms | 409 KiB | 5 Q