3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatten_array($array, $flat = array()) { $ar = array(); foreach ($array as $i => $items) { foreach ($items as $key => $value) { $ar[$key.'-'.($i+1)] = $value; } } return $ar; } // this line generates a 10x10 multi-d array $a = array_fill(0, 10, array_fill(0, 10, 0)); $flat_array = flatten_array($a); var_dump($flat_array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E2tij
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $flat_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'array_fill'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 10
          3        INIT_FCALL                                               'array_fill'
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 10
          6        SEND_VAL                                                 0
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10        ASSIGN                                                   !0, $3
   17    11        INIT_FCALL                                               'flatten_array'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0  $5      
         14        ASSIGN                                                   !1, $5
   18    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function flatten_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/E2tij
function name:  flatten_array
number of ops:  20
compiled vars:  !0 = $array, !1 = $flat, !2 = $ar, !3 = $items, !4 = $i, !5 = $value, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    4     2        ASSIGN                                                   !2, <array>
    6     3      > FE_RESET_R                                       $8      !0, ->17
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->17
          5    >   ASSIGN                                                   !4, ~9
    7     6      > FE_RESET_R                                       $11     !3, ->15
          7    > > FE_FETCH_R                                       ~12     $11, !5, ->15
          8    >   ASSIGN                                                   !6, ~12
    8     9        CONCAT                                           ~14     !6, '-'
         10        ADD                                              ~15     !4, 1
         11        CONCAT                                           ~16     ~14, ~15
         12        ASSIGN_DIM                                               !2, ~16
         13        OP_DATA                                                  !5
    7    14      > JMP                                                      ->7
         15    >   FE_FREE                                                  $11
    6    16      > JMP                                                      ->4
         17    >   FE_FREE                                                  $8
   11    18      > RETURN                                                   !2
   12    19*     > RETURN                                                   null

End of function flatten_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
235.72 ms | 1407 KiB | 18 Q