3v4l.org

run code in 300+ PHP versions simultaneously
<?php function not_reference($object) { $object = new \stdClass(); $object->foo = 'bar'; } function by_reference(&$object) { $object = new \stdClass(); $object->foo = 'bar'; } $a = new \stdClass(); $a->foo = 'a'; not_reference($a); var_dump($a); by_reference($a); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HmA7s
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $1      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   13     3        ASSIGN_OBJ                                               !0, 'foo'
          4        OP_DATA                                                  'a'
   15     5        INIT_FCALL                                               'not_reference'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0          
   16     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   18    11        INIT_FCALL                                               'by_reference'
         12        SEND_REF                                                 !0
         13        DO_FCALL                                      0          
   19    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function not_reference:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HmA7s
function name:  not_reference
number of ops:  7
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        NEW                                              $1      'stdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
    5     4        ASSIGN_OBJ                                               !0, 'foo'
          5        OP_DATA                                                  'bar'
    6     6      > RETURN                                                   null

End of function not_reference

Function by_reference:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HmA7s
function name:  by_reference
number of ops:  7
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        NEW                                              $1      'stdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
    9     4        ASSIGN_OBJ                                               !0, 'foo'
          5        OP_DATA                                                  'bar'
   10     6      > RETURN                                                   null

End of function by_reference

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.55 ms | 1403 KiB | 17 Q