3v4l.org

run code in 500+ PHP versions simultaneously
<?php function doSmth(int $mem): void { $array = range(0, 99); echo 'memory in function: ' . memory_get_usage() - $mem . PHP_EOL; } // Сначала выводим значение memory_get_usage() echo 'memory before use: ' . memory_get_usage() . PHP_EOL; $mem = memory_get_usage(); echo 'init $mem' . 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/039Fh
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        CONCAT                                               ~2      'memory+before+use%3A+', $1
          3        CONCAT                                               ~3      ~2, '%0A'
          4        ECHO                                                         ~3
   10     5        INIT_FCALL                                                   'memory_get_usage'
          6        DO_ICALL                                             $4      
          7        ASSIGN                                                       !0, $4
          8        ECHO                                                         'init+%24mem%0A'
   12     9        INIT_FCALL                                                   'dosmth'
         10        SEND_VAR                                                     !0
         11        DO_FCALL                                          0          
   13    12        INIT_FCALL                                                   'memory_get_usage'
         13        DO_ICALL                                             $7      
         14        SUB                                                  ~8      $7, !0
         15        CONCAT                                               ~9      'memory+after+use%3A+', ~8
         16        CONCAT                                               ~10     ~9, '%0A'
         17        ECHO                                                         ~10
   14    18      > RETURN                                                       1

Function dosmth:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/039Fh
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        INIT_FCALL                                                   'memory_get_usage'
          7        DO_ICALL                                             $4      
          8        SUB                                                  ~5      $4, !0
          9        CONCAT                                               ~6      'memory+in+function%3A+', ~5
         10        CONCAT                                               ~7      ~6, '%0A'
         11        ECHO                                                         ~7
    6    12      > RETURN                                                       null

End of function dosmth

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.92 ms | 1346 KiB | 16 Q