3v4l.org

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

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

End of function __clone

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.6 ms | 997 KiB | 14 Q