3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj1 = (object) ['name' => 'Jan', 'job' => 'IT']; $obj2 = (object) ['name' => 'Adam', 'job' => 'PR']; $obj3 = (object) ['name'=> 'Wojtek', 'job' => 'IT']; $obj4 = (object) ['name' => 'Marcin', 'job' => 'Car']; $obj = (object) [$obj1, $obj2, $obj3, $obj4]; //your output //var_dump($obj); //get the output of the name of the first object. echo 'Test (as array): '.((array)$obj )[0]->name; echo "\n"; echo 'Test (object): '.$obj->{0}->name;
Output for git.master_jit, git.master, rfc.property-hooks
Test (as array): Jan Test (object): Jan

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:
165.32 ms | 405 KiB | 5 Q