3v4l.org

run code in 300+ PHP versions simultaneously
<?php call_user_func(function(){ echo 'val_val' . PHP_EOL; $a = range(1, 100000); $m = memory_get_usage(); $b = $a; $c = $b; echo ' memory usage: ' . number_format(memory_get_usage() - $m) . PHP_EOL; }); call_user_func(function(){ echo 'ref_val' . PHP_EOL; $a = range(1, 100000); $m = memory_get_usage(); $b = &$a; $c = $b; echo ' memory usage: ' . number_format(memory_get_usage() - $m) . PHP_EOL; }); call_user_func(function(){ echo 'val_ref' . PHP_EOL; $a = range(1, 100000); $m = memory_get_usage(); $b = $a; $c = &$b; echo ' memory usage: ' . number_format(memory_get_usage() - $m) . PHP_EOL; }); call_user_func(function(){ echo 'ref_ref' . PHP_EOL; $a = range(1, 100000); $m = memory_get_usage(); $b = &$a; $c = &$b; echo ' memory usage: ' . number_format(memory_get_usage() - $m) . PHP_EOL; });
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fNRDq
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfNRDq%3A2%240'
   11     1        INIT_USER_CALL                                0          'call_user_func', ~0
          2        DO_FCALL                                      0          
   13     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfNRDq%3A13%241'
   22     4        INIT_USER_CALL                                0          'call_user_func', ~2
          5        DO_FCALL                                      0          
   24     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfNRDq%3A24%242'
   33     7        INIT_USER_CALL                                0          'call_user_func', ~4
          8        DO_FCALL                                      0          
   35     9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfNRDq%3A35%243'
   44    10        INIT_USER_CALL                                0          'call_user_func', ~6
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfNRDq%3A2%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fNRDq
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $a, !1 = $m, !2 = $b, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     'val_val%0A'
    5     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 100000
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !0, $4
    6     6        INIT_FCALL                                               'memory_get_usage'
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
    7     9        ASSIGN                                                   !2, !0
    8    10        ASSIGN                                                   !3, !2
   10    11        INIT_FCALL                                               'number_format'
         12        INIT_FCALL                                               'memory_get_usage'
         13        DO_ICALL                                         $10     
         14        SUB                                              ~11     $10, !1
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                         $12     
         17        CONCAT                                           ~13     '++memory+usage%3A+', $12
         18        CONCAT                                           ~14     ~13, '%0A'
         19        ECHO                                                     ~14
   11    20      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfNRDq%3A2%240

Function %00%7Bclosure%7D%2Fin%2FfNRDq%3A13%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fNRDq
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $a, !1 = $m, !2 = $b, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ECHO                                                     'ref_val%0A'
   16     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 100000
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !0, $4
   17     6        INIT_FCALL                                               'memory_get_usage'
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   18     9        ASSIGN_REF                                               !2, !0
   19    10        ASSIGN                                                   !3, !2
   21    11        INIT_FCALL                                               'number_format'
         12        INIT_FCALL                                               'memory_get_usage'
         13        DO_ICALL                                         $10     
         14        SUB                                              ~11     $10, !1
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                         $12     
         17        CONCAT                                           ~13     '++memory+usage%3A+', $12
         18        CONCAT                                           ~14     ~13, '%0A'
         19        ECHO                                                     ~14
   22    20      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfNRDq%3A13%241

Function %00%7Bclosure%7D%2Fin%2FfNRDq%3A24%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fNRDq
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $a, !1 = $m, !2 = $b, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ECHO                                                     'val_ref%0A'
   27     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 100000
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !0, $4
   28     6        INIT_FCALL                                               'memory_get_usage'
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   29     9        ASSIGN                                                   !2, !0
   30    10        ASSIGN_REF                                               !3, !2
   32    11        INIT_FCALL                                               'number_format'
         12        INIT_FCALL                                               'memory_get_usage'
         13        DO_ICALL                                         $10     
         14        SUB                                              ~11     $10, !1
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                         $12     
         17        CONCAT                                           ~13     '++memory+usage%3A+', $12
         18        CONCAT                                           ~14     ~13, '%0A'
         19        ECHO                                                     ~14
   33    20      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfNRDq%3A24%242

Function %00%7Bclosure%7D%2Fin%2FfNRDq%3A35%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fNRDq
function name:  {closure}
number of ops:  21
compiled vars:  !0 = $a, !1 = $m, !2 = $b, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   ECHO                                                     'ref_ref%0A'
   38     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 100000
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !0, $4
   39     6        INIT_FCALL                                               'memory_get_usage'
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   40     9        ASSIGN_REF                                               !2, !0
   41    10        ASSIGN_REF                                               !3, !2
   43    11        INIT_FCALL                                               'number_format'
         12        INIT_FCALL                                               'memory_get_usage'
         13        DO_ICALL                                         $10     
         14        SUB                                              ~11     $10, !1
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                         $12     
         17        CONCAT                                           ~13     '++memory+usage%3A+', $12
         18        CONCAT                                           ~14     ~13, '%0A'
         19        ECHO                                                     ~14
   44    20      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfNRDq%3A35%243

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.84 ms | 1409 KiB | 19 Q