3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar {} class Foo { private $bar; public function __construct(Bar $bar) { $this->bar = $bar; } public function print() { echo spl_object_hash($this->bar); echo "\n"; } } $b = new Bar(); $f1 = new Foo($b); $f2 = clone $f1; $f1->print(); $f2->print();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/msfmP
function name:  (null)
number of ops:  14
compiled vars:  !0 = $b, !1 = $f1, !2 = $f2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $3      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   21     3        NEW                                              $6      'Foo'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   22     7        CLONE                                            ~9      !1
          8        ASSIGN                                                   !2, ~9
   24     9        INIT_METHOD_CALL                                         !1, 'print'
         10        DO_FCALL                                      0          
   25    11        INIT_METHOD_CALL                                         !2, 'print'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Class Bar: [no user functions]
Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/msfmP
function name:  __construct
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'bar'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function __construct

Function print:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/msfmP
function name:  print
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'spl_object_hash'
          1        FETCH_OBJ_R                                      ~0      'bar'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4        ECHO                                                     $1
   14     5        ECHO                                                     '%0A'
   15     6      > RETURN                                                   null

End of function print

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.18 ms | 1396 KiB | 15 Q