3v4l.org

run code in 300+ PHP versions simultaneously
<?php $buf = ''; report_memory(__LINE__); $buf = implode(range(1,PHP_MAX_INT)); report_memory(__LINE__); example($buf); report_memory(__LINE__); example2($buf); report_memory(__LINE__); function example($str) { report_memory(__LINE__); is_string($str); report_memory(__LINE__); } function example2(& $str) { report_memory(__LINE__); is_string($str); report_memory(__LINE__); } function report_memory($line=0) { echo 'Line: ' . str_pad($line,3) . ' '; echo 'Mem: ' . str_pad(intval(memory_get_usage()/1024 ) . 'K',8) . ' '; echo 'Peak: ' . str_pad(intval(memory_get_peak_usage()/1024) . 'K',8) . ' '; echo "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/idfrq
function name:  (null)
number of ops:  29
compiled vars:  !0 = $buf
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, ''
    4     1        INIT_FCALL_BY_NAME                                       'report_memory'
          2        SEND_VAL_EX                                              4
          3        DO_FCALL                                      0          
    6     4        INIT_FCALL                                               'implode'
          5        INIT_FCALL                                               'range'
          6        SEND_VAL                                                 1
          7        FETCH_CONSTANT                                   ~3      'PHP_MAX_INT'
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                         $5      
         12        ASSIGN                                                   !0, $5
    7    13        INIT_FCALL_BY_NAME                                       'report_memory'
         14        SEND_VAL_EX                                              7
         15        DO_FCALL                                      0          
    9    16        INIT_FCALL_BY_NAME                                       'example'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
   10    19        INIT_FCALL_BY_NAME                                       'report_memory'
         20        SEND_VAL_EX                                              10
         21        DO_FCALL                                      0          
   12    22        INIT_FCALL_BY_NAME                                       'example2'
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0          
   13    25        INIT_FCALL_BY_NAME                                       'report_memory'
         26        SEND_VAL_EX                                              13
         27        DO_FCALL                                      0          
   32    28      > RETURN                                                   1

Function example:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/idfrq
function name:  example
number of ops:  10
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        INIT_FCALL_BY_NAME                                       'report_memory'
          2        SEND_VAL_EX                                              16
          3        DO_FCALL                                      0          
   17     4        TYPE_CHECK                                   64  ~2      !0
          5        FREE                                                     ~2
   18     6        INIT_FCALL_BY_NAME                                       'report_memory'
          7        SEND_VAL_EX                                              18
          8        DO_FCALL                                      0          
   19     9      > RETURN                                                   null

End of function example

Function example2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/idfrq
function name:  example2
number of ops:  10
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        INIT_FCALL_BY_NAME                                       'report_memory'
          2        SEND_VAL_EX                                              22
          3        DO_FCALL                                      0          
   23     4        TYPE_CHECK                                   64  ~2      !0
          5        FREE                                                     ~2
   24     6        INIT_FCALL_BY_NAME                                       'report_memory'
          7        SEND_VAL_EX                                              24
          8        DO_FCALL                                      0          
   25     9      > RETURN                                                   null

End of function example2

Function report_memory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/idfrq
function name:  report_memory
number of ops:  34
compiled vars:  !0 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV_INIT                                        !0      0
   28     1        INIT_FCALL                                               'str_pad'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 3
          4        DO_ICALL                                         $1      
          5        CONCAT                                           ~2      'Line%3A+', $1
          6        CONCAT                                           ~3      ~2, '+'
          7        ECHO                                                     ~3
   29     8        INIT_FCALL                                               'str_pad'
          9        INIT_FCALL                                               'memory_get_usage'
         10        DO_ICALL                                         $4      
         11        DIV                                              ~5      $4, 1024
         12        CAST                                          4  ~6      ~5
         13        CONCAT                                           ~7      ~6, 'K'
         14        SEND_VAL                                                 ~7
         15        SEND_VAL                                                 8
         16        DO_ICALL                                         $8      
         17        CONCAT                                           ~9      'Mem%3A+', $8
         18        CONCAT                                           ~10     ~9, '+'
         19        ECHO                                                     ~10
   30    20        INIT_FCALL                                               'str_pad'
         21        INIT_FCALL                                               'memory_get_peak_usage'
         22        DO_ICALL                                         $11     
         23        DIV                                              ~12     $11, 1024
         24        CAST                                          4  ~13     ~12
         25        CONCAT                                           ~14     ~13, 'K'
         26        SEND_VAL                                                 ~14
         27        SEND_VAL                                                 8
         28        DO_ICALL                                         $15     
         29        CONCAT                                           ~16     'Peak%3A+', $15
         30        CONCAT                                           ~17     ~16, '+'
         31        ECHO                                                     ~17
   31    32        ECHO                                                     '%0A'
   32    33      > RETURN                                                   null

End of function report_memory

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.68 ms | 1404 KiB | 23 Q