3v4l.org

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

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

End of function __clone

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.74 ms | 1399 KiB | 16 Q