3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _flatten_array($arr) { while ($arr) { list($key, $value) = each($arr); is_array($value) ? $arr = $value : $out[$key] = $value; unset($arr[$key]); } return (array)$out; } $aNonFlat = array( 1, 2, array( 3, 4, 5, array( 6, 7 ), 8, 9, ), 10, 11 ); var_export(_flatten_array($aNonFlat));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7cO9N
function name:  (null)
number of ops:  8
compiled vars:  !0 = $aNonFlat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   28     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               '_flatten_array'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function _flatten_array:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 2
Branch analysis from position: 21
Branch analysis from position: 2
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 2
Branch analysis from position: 21
Branch analysis from position: 2
filename:       /in/7cO9N
function name:  _flatten_array
number of ops:  24
compiled vars:  !0 = $arr, !1 = $key, !2 = $value, !3 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1      > JMP                                                      ->20
    4     2    >   INIT_FCALL_BY_NAME                                       'each'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $4      
          5        FETCH_LIST_R                                     $5      $4, 0
          6        ASSIGN                                                   !1, $5
          7        FETCH_LIST_R                                     $7      $4, 1
          8        ASSIGN                                                   !2, $7
          9        FREE                                                     $4
    5    10        TYPE_CHECK                                  128          !2
         11      > JMPZ                                                     ~9, ->15
         12    >   ASSIGN                                           ~10     !0, !2
         13        QM_ASSIGN                                        ~11     ~10
         14      > JMP                                                      ->18
         15    >   ASSIGN_DIM                                       ~12     !3, !1
         16        OP_DATA                                                  !2
         17        QM_ASSIGN                                        ~11     ~12
         18    >   FREE                                                     ~11
    6    19        UNSET_DIM                                                !0, !1
    3    20    > > JMPNZ                                                    !0, ->2
    8    21    >   CAST                                          7  ~13     !3
         22      > RETURN                                                   ~13
    9    23*     > RETURN                                                   null

End of function _flatten_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.15 ms | 1403 KiB | 16 Q