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();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/PlGMR
function name:  (null)
number of ops:  23
compiled vars:  !0 = $json, !1 = $devices, !2 = $device
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A++++%22device%22+%3A+%5B%7B%0A++++++++++++%22id%22+%3A+%2218496597%22%2C%0A++++++++++++%22clientDeviceId%22+%3A+%2218%22%2C%0A++++++++++++%22name%22+%3A+%22Adven%22%2C%0A++++++++++++%22state%22+%3A+1%2C%0A++++++++++++%22statevalue%22+%3A+%220%22%2C%0A++++++++++++%22methods%22+%3A+3%2C%0A++++++++++++%22type%22+%3A+%22device%22%2C%0A++++++++++++%22client%22+%3A+%222612195%22%2C%0A++++++++++++%22online%22+%3A+%221%22%2C%0A++++++++++++%22editable%22+%3A+1%2C%0A++++++++++++%22ignored%22+%3A+0%0A++++++++%7D%2C+%7B%0A++++++++++++%22id%22+%3A+%2218327685%22%2C%0A++++++++++++%22clientDeviceId%22+%3A+%227%22%2C%0A++++++++++++%22name%22+%3A+%22Alla%22%2C%0A++++++++++++%22state%22+%3A+1%2C%0A++++++++++++%22statevalue%22+%3A+null%2C%0A++++++++++++%22methods%22+%3A+3%2C%0A++++++++++++%22type%22+%3A+%22group%22%2C%0A++++++++++++%22client%22+%3A+%22261295%22%2C%0A++++++++++++%22online%22+%3A+%221%22%2C%0A++++++++++++%22editable%22+%3A+1%2C%0A++++++++++++%22ignored%22+%3A+0%0A++++++++%7D%0A++++%5D%0A%7D'
   32     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   34     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
   36     8        FETCH_OBJ_R                                      ~7      !1, 'device'
          9      > FE_RESET_R                                       $8      ~7, ->18
         10    > > FE_FETCH_R                                               $8, !2, ->18
   37    11    >   FETCH_OBJ_R                                      ~9      !2, 'name'
         12        CONCAT                                           ~10     ~9, '+-+'
         13        FETCH_OBJ_R                                      ~11     !2, 'state'
         14        CONCAT                                           ~12     ~10, ~11
         15        CONCAT                                           ~13     ~12, '%0A'
         16        ECHO                                                     ~13
   36    17      > JMP                                                      ->10
         18    >   FE_FREE                                                  $8
   40    19        INIT_FCALL                                               'json_last_error'
         20        DO_ICALL                                         $14     
         21        ECHO                                                     $14
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.32 ms | 1396 KiB | 19 Q