3v4l.org

run code in 300+ PHP versions simultaneously
<?php class bar { protected $baz = "1"; public function set( $val ) { $this->baz = $val; } public function get() { return $this->baz; } } class foo { private $bar; public function __construct( $bar ) { $this->bar = $bar; } public function __clone() { echo __METHOD__ . "\n"; $this->bar = clone $this->bar; } public function get() { return $this->bar; } } $bar = new bar(); $o1 = new foo( $bar ); $o2 = clone $o1; $o2->get()->set( "2" ); var_dump( $o1->get()->get() ); var_dump( $o2->get()->get() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lnQMF
function name:  (null)
number of ops:  29
compiled vars:  !0 = $bar, !1 = $o1, !2 = $o2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $3      'bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   29     3        NEW                                              $6      'foo'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   30     7        CLONE                                            ~9      !1
          8        ASSIGN                                                   !2, ~9
   31     9        INIT_METHOD_CALL                                         !2, 'get'
         10        DO_FCALL                                      0  $11     
         11        INIT_METHOD_CALL                                         $11, 'set'
         12        SEND_VAL_EX                                              '2'
         13        DO_FCALL                                      0          
   32    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !1, 'get'
         16        DO_FCALL                                      0  $13     
         17        INIT_METHOD_CALL                                         $13, 'get'
         18        DO_FCALL                                      0  $14     
         19        SEND_VAR                                                 $14
         20        DO_ICALL                                                 
   33    21        INIT_FCALL                                               'var_dump'
         22        INIT_METHOD_CALL                                         !2, 'get'
         23        DO_FCALL                                      0  $16     
         24        INIT_METHOD_CALL                                         $16, 'get'
         25        DO_FCALL                                      0  $17     
         26        SEND_VAR                                                 $17
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

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

End of function set

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

End of function get

End of class bar.

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

End of function __construct

Function __clone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lnQMF
function name:  __clone
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ECHO                                                     'foo%3A%3A__clone%0A'
   21     1        FETCH_OBJ_R                                      ~1      'bar'
          2        CLONE                                            ~2      ~1
          3        ASSIGN_OBJ                                               'bar'
          4        OP_DATA                                                  ~2
   22     5      > RETURN                                                   null

End of function __clone

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

End of function get

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.33 ms | 1400 KiB | 15 Q