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%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/YAWK2
function name:  (null)
number of ops:  21
compiled vars:  !0 = $memory, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        DO_ICALL                                         $2      
          2        ASSIGN                                                   !0, $2
   16     3        INIT_FCALL                                               'range'
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 99
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   17     8        INIT_FCALL                                               'dosmth'
          9        SEND_REF                                                 !1
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0          
   18    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 = 77) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/YAWK2
function name:  doSmth
number of ops:  36
compiled vars:  !0 = $array, !1 = $memory, !2 = $value, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     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                                                 
    5    10        ASSIGN_DIM                                               !0, 0
         11        OP_DATA                                                  0
    6    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                                                 
    8    20      > FE_RESET_R                                       $11     !0, ->26
         21    > > FE_FETCH_R                                       ~12     $11, !2, ->26
         22    >   ASSIGN                                                   !3, ~12
    9    23        FETCH_DIM_RW                                     $14     !0, !3
         24        PRE_INC                                                  $14
    8    25      > JMP                                                      ->21
         26    >   FE_FREE                                                  $11
   12    27        INIT_FCALL                                               'printf'
         28        SEND_VAL                                                 'memory%3A+%25s%25s'
         29        INIT_FCALL                                               'memory_get_usage'
         30        DO_ICALL                                         $16     
         31        SUB                                              ~17     $16, !1
         32        SEND_VAL                                                 ~17
         33        SEND_VAL                                                 '%0A'
         34        DO_ICALL                                                 
   13    35      > RETURN                                                   null

End of function dosmth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.68 ms | 1007 KiB | 17 Q