3v4l.org

run code in 300+ PHP versions simultaneously
<?php $key = array('accounts', 1, 'uid'); $conf = json_decode('{ "accounts": { "1": { "uid": "1" }, "2": { "uid": "16" } }, "online": [ { "rules": { "language": "pl" }, "tag": { "name" : "kraj", "value": "Polska", "save" : true, "delay": 1800 } } ] } ', true); if (!is_array($key)) { $key = array($key); } if (!empty($key)) { $chain = $conf; foreach ($key as $k) { if ($k == ':first:') { $k = array_shift(array_keys($chain)); } if (is_array($chain) && isset($chain[$k])) { $chain = $chain[$k]; } else { return false; } } print_r($chain); } else { print_r($conf); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 42
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 37
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 37
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 34
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 26
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/e68mD
function name:  (null)
number of ops:  46
compiled vars:  !0 = $key, !1 = $conf, !2 = $chain, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAL                                                 '%7B%0A++%22accounts%22%3A+%7B%0A++++%221%22%3A+%7B%0A++++++%22uid%22%3A+%221%22%0A++++%7D%2C%0A++++%222%22%3A+%7B%0A++++++%22uid%22%3A+%2216%22%0A++++%7D%0A++%7D%2C%0A++++%22online%22%3A+%5B%0A++++++++%7B%0A++++++++++++%22rules%22%3A+%7B%0A++++++++++++++++%22language%22%3A+%22pl%22%0A++++++++++++%7D%2C%0A++++++++++++%22tag%22%3A+%7B%0A++++++++++++++++%22name%22+%3A+%22kraj%22%2C%0A++++++++++++++++%22value%22%3A+%22Polska%22%2C%0A++++++++++++++++%22save%22+%3A+true%2C%0A++++++++++++++++%22delay%22%3A+1800%0A++++++++++++%7D%0A++++++++%7D%0A++++%5D%0A%7D%0A'
   27     3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $5      
    4     5        ASSIGN                                                   !1, $5
   29     6        TYPE_CHECK                                  128  ~7      !0
          7        BOOL_NOT                                         ~8      ~7
          8      > JMPZ                                                     ~8, ->11
   30     9    >   INIT_ARRAY                                       ~9      !0
         10        ASSIGN                                                   !0, ~9
   33    11    >   ISSET_ISEMPTY_CV                                 ~11     !0
         12        BOOL_NOT                                         ~12     ~11
         13      > JMPZ                                                     ~12, ->42
   34    14    >   ASSIGN                                                   !2, !1
   35    15      > FE_RESET_R                                       $14     !0, ->37
         16    > > FE_FETCH_R                                               $14, !3, ->37
   36    17    >   IS_EQUAL                                                 !3, '%3Afirst%3A'
         18      > JMPZ                                                     ~15, ->26
   37    19    >   INIT_FCALL                                               'array_shift'
         20        INIT_FCALL                                               'array_keys'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $16     
         23        SEND_VAR_NO_REF                               0          $16
         24        DO_ICALL                                         $17     
         25        ASSIGN                                                   !3, $17
   39    26    >   TYPE_CHECK                                  128  ~19     !2
         27      > JMPZ_EX                                          ~19     ~19, ->30
         28    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~20     !2, !3
         29        BOOL                                             ~19     ~20
         30    > > JMPZ                                                     ~19, ->34
   40    31    >   FETCH_DIM_R                                      ~21     !2, !3
         32        ASSIGN                                                   !2, ~21
         33      > JMP                                                      ->36
   42    34    >   FE_FREE                                                  $14
         35      > RETURN                                                   <false>
   35    36    > > JMP                                                      ->16
         37    >   FE_FREE                                                  $14
   45    38        INIT_FCALL                                               'print_r'
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                                 
         41      > JMP                                                      ->45
   47    42    >   INIT_FCALL                                               'print_r'
         43        SEND_VAR                                                 !1
         44        DO_ICALL                                                 
   48    45    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.41 ms | 1400 KiB | 21 Q