3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "device" : [{ "id" : "18496597", "clientDeviceId" : "18", "name" : "Adven", "state" : 1, "statevalue" : "0", "methods" : 3, "type" : "device", "client" : "2612195", "online" : "1", "editable" : 1, "ignored" : 0 }, { "id" : "18327685", "clientDeviceId" : "7", "name" : "Alla", "state" : 1, "statevalue" : null, "methods" : 3, "type" : "group", "client" : "261295", "online" : "1", "editable" : 1, "ignored" : 0 } ] }'; $devices = json_decode($json); var_dump($devices); foreach ($devices->device as $device) { echo $device->name . ' - '. $device->state . PHP_EOL; } echo json_last_error();
Output for git.master, git.master_jit, rfc.property-hooks
object(stdClass)#3 (1) { ["device"]=> array(2) { [0]=> object(stdClass)#1 (11) { ["id"]=> string(8) "18496597" ["clientDeviceId"]=> string(2) "18" ["name"]=> string(5) "Adven" ["state"]=> int(1) ["statevalue"]=> string(1) "0" ["methods"]=> int(3) ["type"]=> string(6) "device" ["client"]=> string(7) "2612195" ["online"]=> string(1) "1" ["editable"]=> int(1) ["ignored"]=> int(0) } [1]=> object(stdClass)#2 (11) { ["id"]=> string(8) "18327685" ["clientDeviceId"]=> string(1) "7" ["name"]=> string(4) "Alla" ["state"]=> int(1) ["statevalue"]=> NULL ["methods"]=> int(3) ["type"]=> string(5) "group" ["client"]=> string(6) "261295" ["online"]=> string(1) "1" ["editable"]=> int(1) ["ignored"]=> int(0) } } } Adven - 1 Alla - 1 0

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:
51.49 ms | 403 KiB | 8 Q