3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doSmth(array &$array, int $memory) { printf('memory: %s%s', memory_get_usage() - $memory, PHP_EOL); $array[0] = 0; printf('memory: %s%s', memory_get_usage() - $memory, PHP_EOL); foreach ($array as $i => &$value) { $array[$i] ++; printf('memory: %s, i: %s%s', memory_get_usage() - $memory, $i, PHP_EOL); break; } printf('memory: %s%s', memory_get_usage() - $memory, PHP_EOL); } $memory = memory_get_usage(); $array = range(0, 99); doSmth($array, $memory); printf('memory: %s%s', memory_get_usage() - $memory, PHP_EOL);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m7ou6
function name:  (null)
number of ops:  21
compiled vars:  !0 = $memory, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        DO_ICALL                                         $2      
          2        ASSIGN                                                   !0, $2
   19     3        INIT_FCALL                                               'range'
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 99
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   20     8        INIT_FCALL                                               'dosmth'
          9        SEND_REF                                                 !1
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0          
   21    12        INIT_FCALL                                               'printf'
         13        SEND_VAL                                                 'memory%3A+%25s%25s'
         14        INIT_FCALL                                               'memory_get_usage'
         15        DO_ICALL                                         $7      
         16        SUB                                              ~8      $7, !0
         17        SEND_VAL                                                 ~8
         18        SEND_VAL                                                 '%0A'
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function dosmth:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 21, Position 2 = 36
Branch analysis from position: 21
2 jumps found. (Code = 126) Position 1 = 22, Position 2 = 36
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 36
filename:       /in/m7ou6
function name:  doSmth
number of ops:  46
compiled vars:  !0 = $array, !1 = $memory, !2 = $value, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 'memory%3A+%25s%25s'
          4        INIT_FCALL                                               'memory_get_usage'
          5        DO_ICALL                                         $4      
          6        SUB                                              ~5      $4, !1
          7        SEND_VAL                                                 ~5
          8        SEND_VAL                                                 '%0A'
          9        DO_ICALL                                                 
    6    10        ASSIGN_DIM                                               !0, 0
         11        OP_DATA                                                  0
    7    12        INIT_FCALL                                               'printf'
         13        SEND_VAL                                                 'memory%3A+%25s%25s'
         14        INIT_FCALL                                               'memory_get_usage'
         15        DO_ICALL                                         $8      
         16        SUB                                              ~9      $8, !1
         17        SEND_VAL                                                 ~9
         18        SEND_VAL                                                 '%0A'
         19        DO_ICALL                                                 
    9    20      > FE_RESET_RW                                      $11     !0, ->36
         21    > > FE_FETCH_RW                                      ~12     $11, !2, ->36
         22    >   ASSIGN                                                   !3, ~12
   10    23        FETCH_DIM_RW                                     $14     !0, !3
         24        PRE_INC                                                  $14
   11    25        INIT_FCALL                                               'printf'
         26        SEND_VAL                                                 'memory%3A+%25s%2C+i%3A+%25s%25s'
         27        INIT_FCALL                                               'memory_get_usage'
         28        DO_ICALL                                         $16     
         29        SUB                                              ~17     $16, !1
         30        SEND_VAL                                                 ~17
         31        SEND_VAR                                                 !3
         32        SEND_VAL                                                 '%0A'
         33        DO_ICALL                                                 
   12    34      > JMP                                                      ->36
    9    35*       JMP                                                      ->21
         36    >   FE_FREE                                                  $11
   15    37        INIT_FCALL                                               'printf'
         38        SEND_VAL                                                 'memory%3A+%25s%25s'
         39        INIT_FCALL                                               'memory_get_usage'
         40        DO_ICALL                                         $19     
         41        SUB                                              ~20     $19, !1
         42        SEND_VAL                                                 ~20
         43        SEND_VAL                                                 '%0A'
         44        DO_ICALL                                                 
   16    45      > RETURN                                                   null

End of function dosmth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.45 ms | 1007 KiB | 17 Q