3v4l.org

run code in 500+ PHP versions simultaneously
<?php function myfuncByVal(stdClass $o) { $o->myproperty = "testByVal"; $o = null; } function myfuncByRef(stdClass &$o) { $o->myproperty = "testByRef"; $o = null; } $willPassByVal = new stdClass(); $willPassByRef = new stdClass(); myFuncByVal($willPassByVal); myFuncBYRef($willPassByRef); var_dump(compact('willPassByVal', 'willPassByRef'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5FciZ
function name:  (null)
number of ops:  20
compiled vars:  !0 = $willPassByVal, !1 = $willPassByRef
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   NEW                                                  $2      'stdClass'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   14     3        NEW                                                  $5      'stdClass'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $5
   17     6        INIT_FCALL                                                   'myfuncbyval'
          7        SEND_VAR                                                     !0
          8        DO_FCALL                                          0          
   18     9        INIT_FCALL                                                   'myfuncbyref'
         10        SEND_REF                                                     !1
         11        DO_FCALL                                          0          
   21    12        INIT_FCALL                                                   'var_dump'
         13        INIT_FCALL                                                   'compact'
         14        SEND_VAL                                                     'willPassByVal'
         15        SEND_VAL                                                     'willPassByRef'
         16        DO_ICALL                                             $10     
         17        SEND_VAR                                                     $10
         18        DO_ICALL                                                     
         19      > RETURN                                                       1

Function myfuncbyval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5FciZ
function name:  myfuncByVal
number of ops:  5
compiled vars:  !0 = $o
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        ASSIGN_OBJ                                                   !0, 'myproperty'
          2        OP_DATA                                                      'testByVal'
    5     3        ASSIGN                                                       !0, null
    6     4      > RETURN                                                       null

End of function myfuncbyval

Function myfuncbyref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5FciZ
function name:  myfuncByRef
number of ops:  5
compiled vars:  !0 = $o
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
    9     1        ASSIGN_OBJ                                                   !0, 'myproperty'
          2        OP_DATA                                                      'testByRef'
   10     3        ASSIGN                                                       !0, null
   11     4      > RETURN                                                       null

End of function myfuncbyref

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.67 ms | 1390 KiB | 17 Q