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 . ""; } public function setId($id) { $this->id = $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 $a->setId(5); unset($b); var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH197
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
   16     1        NEW                                              $2      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   17     4        ASSIGN                                                   !1, !0
   18     5        INIT_METHOD_CALL                                         !0, 'setId'
          6        SEND_VAL_EX                                              5
          7        DO_FCALL                                      0          
   19     8        UNSET_CV                                                 !1
   20     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH197
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/nH197
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

Function setid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nH197
function name:  setId
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
   13     3      > RETURN                                                   null

End of function setid

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.69 ms | 1388 KiB | 15 Q