3v4l.org

run code in 300+ PHP versions simultaneously
<?php function recurse_array($in) { if (is_array($in)) { foreach ($in as $val) { recurse_array($val); } } } $array = range(1, 10); $array[10] = $array; $array[10][10] = $array; $array[10][10][10] = $array; $array[10][10][10][10] = $array; $array[10][10][10][10][10] = $array; echo 'memory before: ', memory_get_peak_usage(true), "\n"; recurse_array($array); echo 'memory after: ', memory_get_peak_usage(true);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4bBdv
function name:  (null)
number of ops:  45
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 10
          3        DO_ICALL                                         $1      
          4        ASSIGN                                                   !0, $1
   13     5        QM_ASSIGN                                        ~4      !0
          6        ASSIGN_DIM                                               !0, 10
          7        OP_DATA                                                  ~4
   14     8        QM_ASSIGN                                        ~7      !0
          9        FETCH_DIM_W                                      $5      !0, 10
         10        ASSIGN_DIM                                               $5, 10
         11        OP_DATA                                                  ~7
   15    12        QM_ASSIGN                                        ~11     !0
         13        FETCH_DIM_W                                      $8      !0, 10
         14        FETCH_DIM_W                                      $9      $8, 10
         15        ASSIGN_DIM                                               $9, 10
         16        OP_DATA                                                  ~11
   16    17        QM_ASSIGN                                        ~16     !0
         18        FETCH_DIM_W                                      $12     !0, 10
         19        FETCH_DIM_W                                      $13     $12, 10
         20        FETCH_DIM_W                                      $14     $13, 10
         21        ASSIGN_DIM                                               $14, 10
         22        OP_DATA                                                  ~16
   17    23        QM_ASSIGN                                        ~22     !0
         24        FETCH_DIM_W                                      $17     !0, 10
         25        FETCH_DIM_W                                      $18     $17, 10
         26        FETCH_DIM_W                                      $19     $18, 10
         27        FETCH_DIM_W                                      $20     $19, 10
         28        ASSIGN_DIM                                               $20, 10
         29        OP_DATA                                                  ~22
   19    30        ECHO                                                     'memory+before%3A+'
         31        INIT_FCALL                                               'memory_get_peak_usage'
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $23     
         34        ECHO                                                     $23
         35        ECHO                                                     '%0A'
   20    36        INIT_FCALL                                               'recurse_array'
         37        SEND_VAR                                                 !0
         38        DO_FCALL                                      0          
   21    39        ECHO                                                     'memory+after%3A+'
         40        INIT_FCALL                                               'memory_get_peak_usage'
         41        SEND_VAL                                                 <true>
         42        DO_ICALL                                         $25     
         43        ECHO                                                     $25
         44      > RETURN                                                   1

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

End of function recurse_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.95 ms | 1394 KiB | 18 Q