3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $record_1 = new stdClass(); $record_1->id = 1; $record_2 = new stdClass(); $record_2->id = 2; $record_3 = new stdClass(); $record_3->id = 3; $records = [ $record_1, $record_2, $record_3, ]; $result = array_column($records, function($record) { if ($record->id > 1) return $record; }); var_dump($result);
based on C9Zku
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class Closure could not be converted to string in /in/g0JUY on line 21
Process exited with code 255.
Output for 5.5.24 - 7.0.20
Catchable fatal error: Object of class Closure could not be converted to string in /in/g0JUY on line 21
Process exited with code 255.
Output for 5.4.11 - 5.4.45
Fatal error: Call to undefined function array_column() in /in/g0JUY on line 21
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/g0JUY on line 12
Process exited with code 255.