3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { private $n = 'abc'; private $a = 0; function setName($n) { $this->n = $n; return $this; } function __clone() { $this->a++; } } $x = new x; $y = clone $x->setName('asdf')->setName('def'); print_r($x); print_r($y);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UHrBS
function name:  (null)
number of ops:  18
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'x'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   19     3        INIT_METHOD_CALL                                         !0, 'setName'
          4        SEND_VAL_EX                                              'asdf'
          5        DO_FCALL                                      0  $5      
          6        INIT_METHOD_CALL                                         $5, 'setName'
          7        SEND_VAL_EX                                              'def'
          8        DO_FCALL                                      0  $6      
          9        CLONE                                            ~7      $6
         10        ASSIGN                                                   !1, ~7
   20    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
   21    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class x:
Function setname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UHrBS
function name:  setName
number of ops:  6
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'n'
          2        OP_DATA                                                  !0
   10     3        FETCH_THIS                                       ~2      
          4      > RETURN                                                   ~2
   11     5*     > RETURN                                                   null

End of function setname

Function __clone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UHrBS
function name:  __clone
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   PRE_INC_OBJ                                              'a'
   15     1      > RETURN                                                   null

End of function __clone

End of class x.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.3 ms | 1003 KiB | 14 Q