3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<'JSON' [ {"id":1,"name":"Admin","status":1,"created_at":null,"updated_at":null,"pivot":{"user_id":1,"role_id":1}}, {"id":2,"name":"Secretary","status":1,"created_at":null,"updated_at":null,"pivot":{"user_id":1,"role_id":2}} ] JSON; foreach (json_decode($json) as $obj) if ($obj->name) var_dump($obj);
Output for git.master, git.master_jit, rfc.property-hooks
object(stdClass)#1 (6) { ["id"]=> int(1) ["name"]=> string(5) "Admin" ["status"]=> int(1) ["created_at"]=> NULL ["updated_at"]=> NULL ["pivot"]=> object(stdClass)#2 (2) { ["user_id"]=> int(1) ["role_id"]=> int(1) } } object(stdClass)#3 (6) { ["id"]=> int(2) ["name"]=> string(9) "Secretary" ["status"]=> int(1) ["created_at"]=> NULL ["updated_at"]=> NULL ["pivot"]=> object(stdClass)#4 (2) { ["user_id"]=> int(1) ["role_id"]=> int(2) } }

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:
38.27 ms | 402 KiB | 8 Q