3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public $i = 0; public function __construct(){ $this->i = $this->i + 1; } } $f = new foo(); $x = new $f; echo $f instanceof foo; echo $f->i; echo $x instanceof foo; echo $x->i;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q2QXl
function name:  (null)
number of ops:  16
compiled vars:  !0 = $f, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   12     3        FETCH_CLASS                                   0  $5      !0
          4        NEW                                              $6      $5
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $6
   14     7        INSTANCEOF                                       ~9      !0, 'foo'
          8        ECHO                                                     ~9
   15     9        FETCH_OBJ_R                                      ~10     !0, 'i'
         10        ECHO                                                     ~10
   16    11        INSTANCEOF                                       ~11     !1, 'foo'
         12        ECHO                                                     ~11
   17    13        FETCH_OBJ_R                                      ~12     !1, 'i'
         14        ECHO                                                     ~12
         15      > RETURN                                                   1

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

End of function __construct

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.96 ms | 1393 KiB | 13 Q