3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar; public function __construct() { echo __METHOD__, "\n"; } public function __clone() { echo __METHOD__, "\n"; if ($this->bar instanceof Foo) { $this->bar = clone $this->bar; } } } echo '$a = new Foo() --> '; $a = new Foo(); echo '$a->bar = new Foo(); --> '; $a->bar = new Foo(); echo '$b = clone $a; -->'; $b = clone $a;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b27DV
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ECHO                                                     '%24a+%3D+new+Foo%28%29+--%3E+'
   19     1        NEW                                              $2      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   21     4        ECHO                                                     '%24a-%3Ebar+%3D+new+Foo%28%29%3B+--%3E+'
   22     5        NEW                                              $6      'Foo'
          6        DO_FCALL                                      0          
          7        ASSIGN_OBJ                                               !0, 'bar'
          8        OP_DATA                                                  $6
   24     9        ECHO                                                     '%24b+%3D+clone+%24a%3B+--%3E'
   25    10        CLONE                                            ~8      !0
         11        ASSIGN                                                   !1, ~8
         12      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b27DV
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ECHO                                                     'Foo%3A%3A__construct'
          1        ECHO                                                     '%0A'
    7     2      > RETURN                                                   null

End of function __construct

Function __clone:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/b27DV
function name:  __clone
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'Foo%3A%3A__clone'
          1        ECHO                                                     '%0A'
   12     2        FETCH_OBJ_R                                      ~0      'bar'
          3        INSTANCEOF                                               ~0, 'Foo'
          4      > JMPZ                                                     ~1, ->9
   13     5    >   FETCH_OBJ_R                                      ~3      'bar'
          6        CLONE                                            ~4      ~3
          7        ASSIGN_OBJ                                               'bar'
          8        OP_DATA                                                  ~4
   15     9    > > RETURN                                                   null

End of function __clone

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.2 ms | 1395 KiB | 13 Q