3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'Foo', 'bAr' => 'BaR', 'suB' => [ 'a' => 1, 2 => 'b', 'C' => null, ], 'obj' => (object) [ 'd' => 1.333, 'SubArR' => [ 'This' => 'Is', 'a' => 'challenge', ] ] ]; function recursiveWalker(array|object &$level, callable $callback) { foreach ($level as &$v) { switch (gettype($v)) { case 'string' : $v = $callback($v); break; case 'array' : case 'object' : (__FUNCTION__)($v, $callback); } } } recursiveWalker($array, 'strtolower'); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8h0pe
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_ARRAY                                       ~1      'Foo'
    5     1        ADD_ARRAY_ELEMENT                                ~1      'BaR', 'bAr'
    4     2        ADD_ARRAY_ELEMENT                                ~1      <array>, 'suB'
   12     3        CAST                                          8  ~2      <array>
          4        ADD_ARRAY_ELEMENT                                ~1      ~2, 'obj'
    3     5        ASSIGN                                                   !0, ~1
   29     6        INIT_FCALL                                               'recursivewalker'
          7        SEND_REF                                                 !0
          8        SEND_VAL                                                 'strtolower'
          9        DO_FCALL                                      0          
   30    10        INIT_FCALL                                               'var_export'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function recursivewalker:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
5 jumps found. (Code = 188) Position 1 = 13, Position 2 = 18, Position 3 = 18, Position 4 = 22, Position 5 = 6
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
Branch analysis from position: 22
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 18
Branch analysis from position: 18
Branch analysis from position: 13
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/8h0pe
function name:  recursiveWalker
number of ops:  26
compiled vars:  !0 = $level, !1 = $callback, !2 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2      > FE_RESET_RW                                      $3      !0, ->24
          3    > > FE_FETCH_RW                                              $3, !2, ->24
   22     4    >   GET_TYPE                                         ~4      !2
          5      > SWITCH_STRING                                            ~4, [ 'string':->13, 'array':->18, 'object':->18, ], ->22
   23     6    >   CASE                                                     ~4, 'string'
          7      > JMPNZ                                                    ~5, ->13
   24     8    >   CASE                                                     ~4, 'array'
          9      > JMPNZ                                                    ~5, ->18
   25    10    >   CASE                                                     ~4, 'object'
         11      > JMPNZ                                                    ~5, ->18
         12    > > JMP                                                      ->22
   23    13    >   INIT_DYNAMIC_CALL                                        !1
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0  $6      
         16        ASSIGN                                                   !2, $6
         17      > JMP                                                      ->22
   25    18    >   INIT_FCALL_BY_NAME                                       'recursiveWalker'
         19        SEND_VAR_EX                                              !2
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0          
         22    >   FREE                                                     ~4
   21    23      > JMP                                                      ->3
         24    >   FE_FREE                                                  $3
   28    25      > RETURN                                                   null

End of function recursivewalker

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.8 ms | 1012 KiB | 15 Q