3v4l.org

run code in 300+ PHP versions simultaneously
<?php function breadcrumb($array) { $output = []; foreach ($array as $key => $value) { if (is_array($value)) { foreach (breadcrumb($value) as $breadcrumb) { $output[] = $key . ' > ' . $breadcrumb; } } else { $output[] = $key; } } return $output; } $array = [ 'note' => [ 'to' => [ 'user' => [ 'name' => 'First user', ], 'abc' => 123, 'lmn' => 4582, ], 'from' => 'Jani', 'heading' => 'Reminder', 'body' => [ 'abc' => 123 ] ] ]; var_dump(breadcrumb($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VRmCA
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   35     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'breadcrumb'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function breadcrumb:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/VRmCA
function name:  breadcrumb
number of ops:  25
compiled vars:  !0 = $array, !1 = $output, !2 = $value, !3 = $key, !4 = $breadcrumb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    6     2      > FE_RESET_R                                       $6      !0, ->22
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->22
          4    >   ASSIGN                                                   !3, ~7
    7     5        TYPE_CHECK                                  128          !2
          6      > JMPZ                                                     ~9, ->19
    8     7    >   INIT_FCALL_BY_NAME                                       'breadcrumb'
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0  $10     
         10      > FE_RESET_R                                       $11     $10, ->17
         11    > > FE_FETCH_R                                               $11, !4, ->17
    9    12    >   CONCAT                                           ~13     !3, '+%3E+'
         13        CONCAT                                           ~14     ~13, !4
         14        ASSIGN_DIM                                               !1
         15        OP_DATA                                                  ~14
    8    16      > JMP                                                      ->11
         17    >   FE_FREE                                                  $11
    7    18      > JMP                                                      ->21
   12    19    >   ASSIGN_DIM                                               !1
         20        OP_DATA                                                  !3
    6    21    > > JMP                                                      ->3
         22    >   FE_FREE                                                  $6
   15    23      > RETURN                                                   !1
   16    24*     > RETURN                                                   null

End of function breadcrumb

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.78 ms | 1017 KiB | 15 Q