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/bZHPv
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        INIT_FCALL                                               'memory_get_usage'
          5        DO_ICALL                                         $3      
          6        CONCAT                                           ~4      'memory+before+use%3A+', $3
          7        CONCAT                                           ~5      ~4, '%0A'
          8        ECHO                                                     ~5
   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/bZHPv
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.0.0


preferences:
144.96 ms | 1403 KiB | 18 Q