3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [ (object) ['id' => 1, 'name' => 'hovno'], (object) ['id' => 2, 'name' => 'piča'], ]; array_walk($array, function($item) { return $item->id; }); var_dump($array); echo implode(',', $array);
based on CY41O
Output for 7.1.0 - 7.2.0
array(2) { [0]=> object(stdClass)#1 (2) { ["id"]=> int(1) ["name"]=> string(5) "hovno" } [1]=> object(stdClass)#2 (2) { ["id"]=> int(2) ["name"]=> string(5) "piča" } } Recoverable fatal error: Object of class stdClass could not be converted to string in /in/eZcE3 on line 13
Process exited with code 255.
Output for 5.4.10 - 7.0.20
array(2) { [0]=> object(stdClass)#1 (2) { ["id"]=> int(1) ["name"]=> string(5) "hovno" } [1]=> object(stdClass)#2 (2) { ["id"]=> int(2) ["name"]=> string(5) "piča" } } Catchable fatal error: Object of class stdClass could not be converted to string in /in/eZcE3 on line 13
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/eZcE3 on line 3
Process exited with code 255.