3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatten_array($simple){ static $outputs=array(); foreach ( $simple as $value) { if(is_array($value)){ flatten_array($value); } else { $outputs[]=$value; } } return $outputs; } $eg=['s'=>['p','n'=>['t']]]; $out=flatten_array($eg); print_r($out); echo "\n---\n"; $out=flatten_array($eg); print_r($out);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mSkNJ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $eg, !1 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'flatten_array'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   16     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
   17     8        ECHO                                                     '%0A---%0A'
   19     9        INIT_FCALL                                               'flatten_array'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0  $6      
         12        ASSIGN                                                   !1, $6
   20    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function flatten_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/mSkNJ
function name:  flatten_array
number of ops:  16
compiled vars:  !0 = $simple, !1 = $outputs, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        BIND_STATIC                                              !1
    4     2      > FE_RESET_R                                       $3      !0, ->13
          3    > > FE_FETCH_R                                               $3, !2, ->13
    5     4    >   TYPE_CHECK                                  128          !2
          5      > JMPZ                                                     ~4, ->10
    6     6    >   INIT_FCALL_BY_NAME                                       'flatten_array'
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
          9      > JMP                                                      ->12
    8    10    >   ASSIGN_DIM                                               !1
         11        OP_DATA                                                  !2
    4    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $3
   11    14      > RETURN                                                   !1
   12    15*     > RETURN                                                   null

End of function flatten_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
198.44 ms | 1403 KiB | 17 Q