3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function __clone() { echo 'Cloned it!' . PHP_EOL; return 'foo'; } } $a = new A(); $b = clone $a; $c = $a->__clone(); var_dump($a, $b, $c);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v1ZIS
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $3      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   13     3        CLONE                                            ~6      !0
          4        ASSIGN                                                   !1, ~6
   14     5        INIT_METHOD_CALL                                         !0, '__clone'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !2, $8
   16     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !2
         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/v1ZIS
function name:  __clone
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ECHO                                                     'Cloned+it%21%0A'
    7     1      > RETURN                                                   'foo'
    8     2*     > RETURN                                                   null

End of function __clone

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.47 ms | 1395 KiB | 15 Q