3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $id; public function __construct() { $this->id = 1; } public function __toString() { return $id . ""; } } $a = new Foo; // $a is a pointer pointing to Foo object 0 $b = $a; // $b is a pointer pointing to Foo object 0, however, $b is a copy of $a unset($a); var_dump($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kPTDU
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
   13     1        NEW                                              $2      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   14     4        ASSIGN                                                   !1, !0
   15     5        UNSET_CV                                                 !0
   16     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

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

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kPTDU
function name:  __toString
number of ops:  5
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   CONCAT                                           ~1      !0, ''
          1        VERIFY_RETURN_TYPE                                       ~1
          2      > RETURN                                                   ~1
   10     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function __tostring

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.55 ms | 1395 KiB | 15 Q