3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doSmth(int $mem): void { $array = range(0, 99); echo 'memory in function: ' , memory_get_usage() - $mem , PHP_EOL; } // Сначала инициализируем переменную $mem $mem = memory_get_usage(); echo 'init $mem' . PHP_EOL; echo 'memory before use: ' , memory_get_usage() , PHP_EOL; doSmth($mem); echo 'memory after use: ' , memory_get_usage() - $mem , PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6cU5f
function name:  (null)
number of ops:  19
compiled vars:  !0 = $mem
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        DO_ICALL                                         $1      
          2        ASSIGN                                                   !0, $1
          3        ECHO                                                     'init+%24mem%0A'
   10     4        ECHO                                                     'memory+before+use%3A+'
          5        INIT_FCALL                                               'memory_get_usage'
          6        DO_ICALL                                         $3      
          7        ECHO                                                     $3
          8        ECHO                                                     '%0A'
   12     9        INIT_FCALL                                               'dosmth'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0          
   13    12        ECHO                                                     'memory+after+use%3A+'
         13        INIT_FCALL                                               'memory_get_usage'
         14        DO_ICALL                                         $5      
         15        SUB                                              ~6      $5, !0
         16        ECHO                                                     ~6
         17        ECHO                                                     '%0A'
   14    18      > RETURN                                                   1

Function dosmth:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6cU5f
function name:  doSmth
number of ops:  13
compiled vars:  !0 = $mem, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 99
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    5     6        ECHO                                                     'memory+in+function%3A+'
          7        INIT_FCALL                                               'memory_get_usage'
          8        DO_ICALL                                         $4      
          9        SUB                                              ~5      $4, !0
         10        ECHO                                                     ~5
         11        ECHO                                                     '%0A'
    6    12      > RETURN                                                   null

End of function dosmth

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.26 ms | 1004 KiB | 16 Q