3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct( public DateTime $bar ) {} public function __clone () { $this->bar = clone $this->bar; } } $f = new Foo(new Datetime()); var_dump($f); var_dump(clone $f);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uXjCl
function name:  (null)
number of ops:  14
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'Foo'
          1        NEW                                              $2      'Datetime'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   19     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   20     9        INIT_FCALL                                               'var_dump'
         10        CLONE                                            ~7      !0
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uXjCl
function name:  __construct
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'bar'
          2        OP_DATA                                                  !0
    7     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/uXjCl
function name:  __clone
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_OBJ_R                                      ~1      'bar'
          1        CLONE                                            ~2      ~1
          2        ASSIGN_OBJ                                               'bar'
          3        OP_DATA                                                  ~2
   12     4      > RETURN                                                   null

End of function __clone

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.16 ms | 1396 KiB | 15 Q