3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aPools = []; $aPools[1] = [ 'Redeployment' => 100, 'TalentPool' => 500, ]; $aPools[2] = []; function array_flatten($aArray) { $aOut = array(); foreach ($aArray as $mSubItem) { if(is_array($mSubItem)) { $aOut = array_merge($aOut, array_flatten($mSubItem)); } else { $aOut[] = $mSubItem; } } return $aOut; } print_r(array_flatten($aPools));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oJ45U
function name:  (null)
number of ops:  12
compiled vars:  !0 = $aPools
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0, 1
    5     2        OP_DATA                                                  <array>
    8     3        ASSIGN_DIM                                               !0, 2
          4        OP_DATA                                                  <array>
   27     5        INIT_FCALL                                               'print_r'
          6        INIT_FCALL                                               'array_flatten'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

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

End of function array_flatten

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.52 ms | 1403 KiB | 18 Q