3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatArray($array) { $retval = array(); foreach ($array as $val) { if (is_array($val)) $retval = array_merge($retval, flatArray($val)); else $retval[] = $val; } return $retval; } $array1 = [['#90', '#91'], ['#92', '#93', '#94', '#95', '#96']]; $array2 = ['#82', '#83', '#84', '#85', '#86']; $array3 = [['#90', '#91', ['100', '101']], ['#92', '#93', '#94', '#95', '#96']]; print_r(flatArray($array1)); print_r(flatArray($array2)); print_r(flatArray($array3));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r6BsF
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array1, !1 = $array2, !2 = $array3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   18     2        ASSIGN                                                   !2, <array>
   20     3        INIT_FCALL                                               'print_r'
          4        INIT_FCALL                                               'flatarray'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                                 
   21     9        INIT_FCALL                                               'print_r'
         10        INIT_FCALL                                               'flatarray'
         11        SEND_VAR                                                 !1
         12        DO_FCALL                                      0  $8      
         13        SEND_VAR                                                 $8
         14        DO_ICALL                                                 
   22    15        INIT_FCALL                                               'print_r'
         16        INIT_FCALL                                               'flatarray'
         17        SEND_VAR                                                 !2
         18        DO_FCALL                                      0  $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function flatarray:
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/r6BsF
function name:  flatArray
number of ops:  21
compiled vars:  !0 = $array, !1 = $retval, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    7     2      > FE_RESET_R                                       $4      !0, ->18
          3    > > FE_FETCH_R                                               $4, !2, ->18
    8     4    >   TYPE_CHECK                                  128          !2
          5      > JMPZ                                                     ~5, ->15
    9     6    >   INIT_FCALL                                               'array_merge'
          7        SEND_VAR                                                 !1
          8        INIT_FCALL_BY_NAME                                       'flatArray'
          9        SEND_VAR_EX                                              !2
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                         $7      
         13        ASSIGN                                                   !1, $7
    8    14      > JMP                                                      ->17
   11    15    >   ASSIGN_DIM                                               !1
         16        OP_DATA                                                  !2
    7    17    > > JMP                                                      ->3
         18    >   FE_FREE                                                  $4
   13    19      > RETURN                                                   !1
   14    20*     > RETURN                                                   null

End of function flatarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.94 ms | 1010 KiB | 18 Q