3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_flatten($array, $keychain = '/') { $data = array(); foreach($array as $key=> $value) { if(is_array($value)) { $data = array_merge($data, array_flatten($value, $keychain.$key.'/')); } else { $data[$keychain.$key] = $value; } } return $data; } $array = array( array( 'foo' => 'bar', 'baz' => 'blah' ), array( 'foo' => 'bar', 'baz' => 'blah' ) ); var_dump(array_flatten($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7O8TT
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_FCALL                                               'var_dump'
          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 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/7O8TT
function name:  array_flatten
number of ops:  27
compiled vars:  !0 = $array, !1 = $keychain, !2 = $data, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      '%2F'
    4     2        ASSIGN                                                   !2, <array>
    5     3      > FE_RESET_R                                       $6      !0, ->24
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->24
          5    >   ASSIGN                                                   !4, ~7
    7     6        TYPE_CHECK                                  128          !3
          7      > JMPZ                                                     ~9, ->20
    9     8    >   INIT_FCALL                                               'array_merge'
          9        SEND_VAR                                                 !2
         10        INIT_FCALL_BY_NAME                                       'array_flatten'
         11        SEND_VAR_EX                                              !3
         12        CONCAT                                           ~10     !1, !4
         13        CONCAT                                           ~11     ~10, '%2F'
         14        SEND_VAL_EX                                              ~11
         15        DO_FCALL                                      0  $12     
         16        SEND_VAR                                                 $12
         17        DO_ICALL                                         $13     
         18        ASSIGN                                                   !2, $13
         19      > JMP                                                      ->23
   13    20    >   CONCAT                                           ~15     !1, !4
         21        ASSIGN_DIM                                               !2, ~15
         22        OP_DATA                                                  !3
    5    23    > > JMP                                                      ->4
         24    >   FE_FREE                                                  $6
   16    25      > RETURN                                                   !2
   17    26*     > RETURN                                                   null

End of function array_flatten

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.66 ms | 1403 KiB | 18 Q