3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); ini_set('display_errors', true); function by_ref(&$value) { echo "Call by ref value:\n"; var_dump($value); } function by_value($value) { echo "Call by value value:\n"; var_dump($value); } $thing = array(1,2); echo "Before call by ref:\n"; var_dump($thing); by_ref($thing[5][6]); echo "After call by ref:\n"; var_dump($thing); echo "Before call by value\n"; by_value($thing[7][8]); echo "After call by value:\n"; var_dump($thing); echo "Before call by ref again:\n"; by_ref($thing[7][8]); echo "After call by ref again:\n"; var_dump($thing);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuDs6
function name:  (null)
number of ops:  42
compiled vars:  !0 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    3     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                                 
   13     7        ASSIGN                                                   !0, <array>
   14     8        ECHO                                                     'Before+call+by+ref%3A%0A'
   15     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   16    12        INIT_FCALL                                               'by_ref'
         13        FETCH_DIM_W                                      $5      !0, 5
         14        FETCH_DIM_W                                      $6      $5, 6
         15        SEND_REF                                                 $6
         16        DO_FCALL                                      0          
   17    17        ECHO                                                     'After+call+by+ref%3A%0A'
   18    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   19    21        ECHO                                                     'Before+call+by+value%0A'
   20    22        INIT_FCALL                                               'by_value'
         23        FETCH_DIM_R                                      ~9      !0, 7
         24        FETCH_DIM_R                                      ~10     ~9, 8
         25        SEND_VAL                                                 ~10
         26        DO_FCALL                                      0          
   21    27        ECHO                                                     'After+call+by+value%3A%0A'
   22    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                                 
   23    31        ECHO                                                     'Before+call+by+ref+again%3A%0A'
   24    32        INIT_FCALL                                               'by_ref'
         33        FETCH_DIM_W                                      $13     !0, 7
         34        FETCH_DIM_W                                      $14     $13, 8
         35        SEND_REF                                                 $14
         36        DO_FCALL                                      0          
   25    37        ECHO                                                     'After+call+by+ref+again%3A%0A'
   26    38        INIT_FCALL                                               'var_dump'
         39        SEND_VAR                                                 !0
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Function by_ref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuDs6
function name:  by_ref
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ECHO                                                     'Call+by+ref+value%3A%0A'
    6     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    7     5      > RETURN                                                   null

End of function by_ref

Function by_value:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuDs6
function name:  by_value
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ECHO                                                     'Call+by+value+value%3A%0A'
   10     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   11     5      > RETURN                                                   null

End of function by_value

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.21 ms | 1403 KiB | 22 Q