3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_flatten($array, $keychain = '/', $data = '') { if (!is_array($data)) $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/815Hq
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 = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 28
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 28
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 24
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 7
filename:       /in/815Hq
function name:  array_flatten
number of ops:  31
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'
          2        RECV_INIT                                        !2      ''
    4     3        TYPE_CHECK                                  128  ~5      !2
          4        BOOL_NOT                                         ~6      ~5
          5      > JMPZ                                                     ~6, ->7
          6    >   ASSIGN                                                   !2, <array>
    5     7    > > FE_RESET_R                                       $8      !0, ->28
          8    > > FE_FETCH_R                                       ~9      $8, !3, ->28
          9    >   ASSIGN                                                   !4, ~9
    7    10        TYPE_CHECK                                  128          !3
         11      > JMPZ                                                     ~11, ->24
    9    12    >   INIT_FCALL                                               'array_merge'
         13        SEND_VAR                                                 !2
         14        INIT_FCALL_BY_NAME                                       'array_flatten'
         15        SEND_VAR_EX                                              !3
         16        CONCAT                                           ~12     !1, !4
         17        CONCAT                                           ~13     ~12, '%2F'
         18        SEND_VAL_EX                                              ~13
         19        DO_FCALL                                      0  $14     
         20        SEND_VAR                                                 $14
         21        DO_ICALL                                         $15     
         22        ASSIGN                                                   !2, $15
         23      > JMP                                                      ->27
   13    24    >   CONCAT                                           ~17     !1, !4
         25        ASSIGN_DIM                                               !2, ~17
         26        OP_DATA                                                  !3
    5    27    > > JMP                                                      ->8
         28    >   FE_FREE                                                  $8
   16    29      > RETURN                                                   !2
   17    30*     > RETURN                                                   null

End of function array_flatten

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.08 ms | 1407 KiB | 18 Q