3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 1 => [ 1 => [ 'anna', 'alice' ], 2 => [ 'bob', 'bartold' ] ], 2 => [ 1 => [ 'carol' ], 2 => [ 'david' ] ] ]; $result = []; $iterator = new \RecursiveIteratorIterator( new \RecursiveArrayIterator($array) ); foreach ($iterator as $key => $row) { $result[$key] = $row; } //array_walk_recursive($array, function ($e) use (&$result) {$result[] = $e;}); var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/ZqDLk
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array, !1 = $result, !2 = $iterator, !3 = $row, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   24     1        ASSIGN                                                   !1, <array>
   26     2        NEW                                              $7      'RecursiveIteratorIterator'
   27     3        NEW                                              $8      'RecursiveArrayIterator'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $8
          7        DO_FCALL                                      0          
   26     8        ASSIGN                                                   !2, $7
   30     9      > FE_RESET_R                                       $12     !2, ->15
         10    > > FE_FETCH_R                                       ~13     $12, !3, ->15
         11    >   ASSIGN                                                   !4, ~13
   31    12        ASSIGN_DIM                                               !1, !4
         13        OP_DATA                                                  !3
   30    14      > JMP                                                      ->10
         15    >   FE_FREE                                                  $12
   36    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.3 ms | 1395 KiB | 15 Q