3v4l.org

run code in 300+ PHP versions simultaneously
<?php $o1 = new stdClass(); $o1->id = 123; $o1->title = 'test'; $o2 = new stdClass(); $o2->id = 456; $o2->title = 'test2'; $arrofobjects = [ $o1,$o2 ]; var_dump($arrofobjects); $newArr = array_map(function($obj) { return [$obj->id => $obj->title]; }, $arrofobjects); var_dump($newArr);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> object(stdClass)#1 (2) { ["id"]=> int(123) ["title"]=> string(4) "test" } [1]=> object(stdClass)#2 (2) { ["id"]=> int(456) ["title"]=> string(5) "test2" } } array(2) { [0]=> array(1) { [123]=> string(4) "test" } [1]=> array(1) { [456]=> string(5) "test2" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.87 ms | 402 KiB | 8 Q