3v4l.org

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

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

End of function change_obj

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

End of function replace_obj

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.94 ms | 1399 KiB | 17 Q