3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($str) { test2($str); } function test2($str) { test3($str); } function test3($str) { echo "before: ".round(memory_get_usage()/1024/1024, 2)." MB\n"; $t = microtime(true); debug_backtrace(false); echo "time: ".(microtime(true)-$t)." ms\n"; echo "after: ".round(memory_get_usage()/1024/1024, 2)." MB\n"; } test(str_repeat('a', 10000000));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hWbBN
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'test'
          1        INIT_FCALL                                               'str_repeat'
          2        SEND_VAL                                                 'a'
          3        SEND_VAL                                                 10000000
          4        DO_ICALL                                         $0      
          5        SEND_VAR                                                 $0
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hWbBN
function name:  test
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL_BY_NAME                                       'test2'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    4     4      > RETURN                                                   null

End of function test

Function test2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hWbBN
function name:  test2
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL_BY_NAME                                       'test3'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    7     4      > RETURN                                                   null

End of function test2

Function test3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hWbBN
function name:  test3
number of ops:  38
compiled vars:  !0 = $str, !1 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'round'
          2        INIT_FCALL                                               'memory_get_usage'
          3        DO_ICALL                                         $2      
          4        DIV                                              ~3      $2, 1024
          5        DIV                                              ~4      ~3, 1024
          6        SEND_VAL                                                 ~4
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $5      
          9        CONCAT                                           ~6      'before%3A+', $5
         10        CONCAT                                           ~7      ~6, '+MB%0A'
         11        ECHO                                                     ~7
   10    12        INIT_FCALL                                               'microtime'
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                         $8      
         15        ASSIGN                                                   !1, $8
   11    16        INIT_FCALL                                               'debug_backtrace'
         17        SEND_VAL                                                 <false>
         18        DO_ICALL                                                 
   12    19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 <true>
         21        DO_ICALL                                         $11     
         22        SUB                                              ~12     $11, !1
         23        CONCAT                                           ~13     'time%3A+', ~12
         24        CONCAT                                           ~14     ~13, '+ms%0A'
         25        ECHO                                                     ~14
   13    26        INIT_FCALL                                               'round'
         27        INIT_FCALL                                               'memory_get_usage'
         28        DO_ICALL                                         $15     
         29        DIV                                              ~16     $15, 1024
         30        DIV                                              ~17     ~16, 1024
         31        SEND_VAL                                                 ~17
         32        SEND_VAL                                                 2
         33        DO_ICALL                                         $18     
         34        CONCAT                                           ~19     'after%3A+', $18
         35        CONCAT                                           ~20     ~19, '+MB%0A'
         36        ECHO                                                     ~20
   14    37      > RETURN                                                   null

End of function test3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.2 ms | 1403 KiB | 24 Q