3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Foo { private $bar; public function withBar(int $bar) { $foo = clone $this; $foo->bar = $bar; return $foo; } public function __clone() { echo __METHOD__, PHP_EOL; } public function __destruct() { echo __METHOD__, PHP_EOL; } } function test() { $foo = new Foo(); $bar = $foo->withBar(42); echo 'test()', PHP_EOL; } test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZVkRY
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZVkRY
function name:  test
number of ops:  10
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   29     3        INIT_METHOD_CALL                                         !0, 'withBar'
          4        SEND_VAL_EX                                              42
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !1, $5
   31     7        ECHO                                                     'test%28%29'
          8        ECHO                                                     '%0A'
   32     9      > RETURN                                                   null

End of function test

Class Foo:
Function withbar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZVkRY
function name:  withBar
number of ops:  8
compiled vars:  !0 = $bar, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        FETCH_THIS                                       ~2      
          2        CLONE                                            ~3      ~2
          3        ASSIGN                                                   !1, ~3
   11     4        ASSIGN_OBJ                                               !1, 'bar'
          5        OP_DATA                                                  !0
   12     6      > RETURN                                                   !1
   13     7*     > RETURN                                                   null

End of function withbar

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

End of function __clone

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

End of function __destruct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.88 ms | 1407 KiB | 14 Q