3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(ini_get('memory_limit')); function memstat($file, $line) { echo sprintf( 'mem @ %s %d: %.2f MB (%.2f MB; peak: %.2f MB)' . PHP_EOL, $file, $line, memory_get_usage() /2**20, memory_get_usage(true) /2**20, memory_get_peak_usage() /2**20 ); } memstat(__FILE__, __LINE__); $str = str_pad('', 9999999, ' '); memstat(__FILE__, __LINE__); print 'end '.strlen($str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BHqWd
function name:  (null)
number of ops:  24
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'ini_get'
          2        SEND_VAL                                                 'memory_limit'
          3        DO_ICALL                                         $1      
          4        SEND_VAR                                                 $1
          5        DO_ICALL                                                 
   16     6        INIT_FCALL                                               'memstat'
          7        SEND_VAL                                                 '%2Fin%2FBHqWd'
          8        SEND_VAL                                                 16
          9        DO_FCALL                                      0          
   17    10        INIT_FCALL                                               'str_pad'
         11        SEND_VAL                                                 ''
         12        SEND_VAL                                                 9999999
         13        SEND_VAL                                                 '+'
         14        DO_ICALL                                         $4      
         15        ASSIGN                                                   !0, $4
   18    16        INIT_FCALL                                               'memstat'
         17        SEND_VAL                                                 '%2Fin%2FBHqWd'
         18        SEND_VAL                                                 18
         19        DO_FCALL                                      0          
   19    20        STRLEN                                           ~7      !0
         21        CONCAT                                           ~8      'end+', ~7
         22        ECHO                                                     ~8
         23      > RETURN                                                   1

Function memstat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BHqWd
function name:  memstat
number of ops:  22
compiled vars:  !0 = $file, !1 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'sprintf'
    7     3        SEND_VAL                                                 'mem+%40+%25s+%25d%3A+%25.2f+MB+%28%25.2f+MB%3B+peak%3A+%25.2f+MB%29%0A'
    8     4        SEND_VAR                                                 !0
    9     5        SEND_VAR                                                 !1
   10     6        INIT_FCALL                                               'memory_get_usage'
          7        DO_ICALL                                         $2      
          8        DIV                                              ~3      $2, 1048576
          9        SEND_VAL                                                 ~3
   11    10        INIT_FCALL                                               'memory_get_usage'
         11        SEND_VAL                                                 <true>
         12        DO_ICALL                                         $4      
         13        DIV                                              ~5      $4, 1048576
         14        SEND_VAL                                                 ~5
   12    15        INIT_FCALL                                               'memory_get_peak_usage'
         16        DO_ICALL                                         $6      
         17        DIV                                              ~7      $6, 1048576
         18        SEND_VAL                                                 ~7
         19        DO_ICALL                                         $8      
         20        ECHO                                                     $8
   14    21      > RETURN                                                   null

End of function memstat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.85 ms | 1407 KiB | 27 Q