3v4l.org

run code in 300+ PHP versions simultaneously
<?php function by_return($dummy=null) { $dummy = str_repeat("1",10 * 1024 * 1024); return $dummy; } function by_reference(&$dummy) { $dummy = null; $dummy = str_repeat("1",10 * 1024 * 1024); } echo memory_get_usage()."/".memory_get_peak_usage()."\n"; //1 always returns: 105493696/105496656 //$nagid = by_return(); echo memory_get_usage()."/".memory_get_peak_usage()."\n"; unset($nagid); //2 always returns: 105493696/210354184 even if we comment 1st part by_reference($dummy); echo memory_get_usage()."/".memory_get_peak_usage()."\n"; unset($dummy);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ORsKi
function name:  (null)
number of ops:  30
compiled vars:  !0 = $nagid, !1 = $dummy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'memory_get_usage'
          1        DO_ICALL                                         $2      
          2        CONCAT                                           ~3      $2, '%2F'
          3        INIT_FCALL                                               'memory_get_peak_usage'
          4        DO_ICALL                                         $4      
          5        CONCAT                                           ~5      ~3, $4
          6        CONCAT                                           ~6      ~5, '%0A'
          7        ECHO                                                     ~6
   15     8        INIT_FCALL                                               'memory_get_usage'
          9        DO_ICALL                                         $7      
         10        CONCAT                                           ~8      $7, '%2F'
         11        INIT_FCALL                                               'memory_get_peak_usage'
         12        DO_ICALL                                         $9      
         13        CONCAT                                           ~10     ~8, $9
         14        CONCAT                                           ~11     ~10, '%0A'
         15        ECHO                                                     ~11
   16    16        UNSET_CV                                                 !0
   18    17        INIT_FCALL                                               'by_reference'
         18        SEND_REF                                                 !1
         19        DO_FCALL                                      0          
   19    20        INIT_FCALL                                               'memory_get_usage'
         21        DO_ICALL                                         $13     
         22        CONCAT                                           ~14     $13, '%2F'
         23        INIT_FCALL                                               'memory_get_peak_usage'
         24        DO_ICALL                                         $15     
         25        CONCAT                                           ~16     ~14, $15
         26        CONCAT                                           ~17     ~16, '%0A'
         27        ECHO                                                     ~17
   20    28        UNSET_CV                                                 !1
         29      > RETURN                                                   1

Function by_return:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ORsKi
function name:  by_return
number of ops:  8
compiled vars:  !0 = $dummy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      null
    4     1        INIT_FCALL                                               'str_repeat'
          2        SEND_VAL                                                 '1'
          3        SEND_VAL                                                 10485760
          4        DO_ICALL                                         $1      
          5        ASSIGN                                                   !0, $1
    5     6      > RETURN                                                   !0
    6     7*     > RETURN                                                   null

End of function by_return

Function by_reference:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ORsKi
function name:  by_reference
number of ops:  8
compiled vars:  !0 = $dummy
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN                                                   !0, null
   10     2        INIT_FCALL                                               'str_repeat'
          3        SEND_VAL                                                 '1'
          4        SEND_VAL                                                 10485760
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
   11     7      > RETURN                                                   null

End of function by_reference

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162 ms | 1403 KiB | 20 Q