3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface FooInterface { public function get(); } class Foo implements FooInterface { protected $thing = 5; public function &get() { return $this->thing; } } $foo = new Foo(); $thing1 = $foo->get(); $thing1 = 6; var_dump($foo->get()); $thing2 = &$foo->get(); $thing2 = 7; var_dump($foo->get());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RTCKf
function name:  (null)
number of ops:  23
compiled vars:  !0 = $foo, !1 = $thing1, !2 = $thing2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'foo'
   11     1        NEW                                              $3      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   12     4        INIT_METHOD_CALL                                         !0, 'get'
          5        DO_FCALL                                      0  $6      
          6        ASSIGN                                                   !1, $6
   13     7        ASSIGN                                                   !1, 6
   14     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'get'
         10        DO_FCALL                                      0  $9      
         11        SEND_VAR                                                 $9
         12        DO_ICALL                                                 
   15    13        INIT_METHOD_CALL                                         !0, 'get'
         14        DO_FCALL                                      0  $11     
         15        ASSIGN_REF                                               !2, $11
   16    16        ASSIGN                                                   !2, 7
   17    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !0, 'get'
         19        DO_FCALL                                      0  $14     
         20        SEND_VAR                                                 $14
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Class FooInterface:
Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RTCKf
function name:  get
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   null

End of function get

End of class FooInterface.

Class Foo:
Function get:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/RTCKf
function name:  get
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_W                                      $0      'thing'
          1      > RETURN_BY_REF                                            $0
    9     2*     > RETURN_BY_REF                                            null

End of function get

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.43 ms | 1401 KiB | 15 Q