3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = ["A" => "a", "B" => ["C"=> "c", "D"=> "d"]]; function array_flatten($array) { $return = array(); foreach ($array as $key => $value) { if (is_array($value)) $return = array_merge($return, array_flatten($value)); else {$return[$key] = $value;} } return $return; } print_r(array_flatten($arr));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u0Rmv
function name:  (null)
number of ops:  8
compiled vars:  !0 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   14     1        INIT_FCALL                                                   'print_r'
          2        INIT_FCALL                                                   'array_flatten'
          3        SEND_VAR                                                     !0
          4        DO_FCALL                                          0  $2      
          5        SEND_VAR                                                     $2
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

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

End of function array_flatten

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.33 ms | 2049 KiB | 16 Q