3v4l.org

run code in 300+ PHP versions simultaneously
<?php function printAll($a, &$output, $prefix = '') { if (!is_array($a) && !is_object($a)) { $prefix = rtrim($prefix, '/'); $output[] = $prefix . ' => ' . $a. "\n"; return; } foreach($a as $k => $v) { $tmp = $prefix; $tmp .= $k . "/"; printAll($v, $output, $tmp); } } $json_str = '{ "one": { "two": 3, "four": [ 5,6,7] }, "eight": { "nine": { "ten":11 } } }'; $object = json_decode($json_str); $res = array(); printAll($object, $res); var_dump($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LSvZN
function name:  (null)
number of ops:  14
compiled vars:  !0 = $json_str, !1 = $object, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, '%7B%0A++++++++++++++++%22one%22%3A%0A++++++++++++++++%7B%0A++++++++++++++++++++%22two%22%3A+3%2C%0A++++++++++++++++++++%22four%22%3A+%5B+5%2C6%2C7%5D%0A++++++++++++++++%7D%2C%0A++++++++++++++++%22eight%22%3A%0A++++++++++++++++%7B%0A++++++++++++++++++++%22nine%22%3A%0A++++++++++++++++++++%7B%0A++++++++++++++++++++++++%22ten%22%3A11%0A++++++++++++++++++++%7D%0A++++++++++++++++%7D%0A++++++++++++%7D'
   32     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
   33     5        ASSIGN                                                   !2, <array>
   34     6        INIT_FCALL                                               'printall'
          7        SEND_VAR                                                 !1
          8        SEND_REF                                                 !2
          9        DO_FCALL                                      0          
   35    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function printall:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 33
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 33
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 9
filename:       /in/LSvZN
function name:  printAll
number of ops:  35
compiled vars:  !0 = $a, !1 = $output, !2 = $prefix, !3 = $v, !4 = $k, !5 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      ''
    4     3        TYPE_CHECK                                  128  ~6      !0
          4        BOOL_NOT                                         ~7      ~6
          5      > JMPZ_EX                                          ~7      ~7, ->9
          6    >   TYPE_CHECK                                  256  ~8      !0
          7        BOOL_NOT                                         ~9      ~8
          8        BOOL                                             ~7      ~9
          9    > > JMPZ                                                     ~7, ->21
    5    10    >   INIT_FCALL                                               'rtrim'
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 '%2F'
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !2, $10
    6    15        CONCAT                                           ~13     !2, '+%3D%3E+'
         16        CONCAT                                           ~14     ~13, !0
         17        CONCAT                                           ~15     ~14, '%0A'
         18        ASSIGN_DIM                                               !1
         19        OP_DATA                                                  ~15
    7    20      > RETURN                                                   null
    9    21    > > FE_RESET_R                                       $16     !0, ->33
         22    > > FE_FETCH_R                                       ~17     $16, !3, ->33
         23    >   ASSIGN                                                   !4, ~17
   10    24        ASSIGN                                                   !5, !2
   11    25        CONCAT                                           ~20     !4, '%2F'
         26        ASSIGN_OP                                     8          !5, ~20
   12    27        INIT_FCALL_BY_NAME                                       'printAll'
         28        SEND_VAR_EX                                              !3
         29        SEND_VAR_EX                                              !1
         30        SEND_VAR_EX                                              !5
         31        DO_FCALL                                      0          
    9    32      > JMP                                                      ->22
         33    >   FE_FREE                                                  $16
   14    34      > RETURN                                                   null

End of function printall

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.51 ms | 1007 KiB | 17 Q