3v4l.org

run code in 500+ PHP versions simultaneously
<?php $o=new C1(); $o->f();/*this is OK, because C1 does not implement anything, it can be declared anywhere.*/ $o=new C2();/*this is NOT ok, because C2 implements something, it must be declared before being used.*/ class C1 /*implements nothing*/ { function f() { echo "Hellooo"; } } class C2 implements Countable{ function count(){} }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EYq8A
function name:  (null)
number of ops:  10
compiled vars:  !0 = $o
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   NEW                                                  $1      'C1'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
    3     3        INIT_METHOD_CALL                                             !0, 'f'
          4        DO_FCALL                                          0          
    4     5        NEW                                                  $5      'C2'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !0, $5
   12     8        DECLARE_CLASS                                                'c2'
   14     9      > RETURN                                                       1

Class C1:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EYq8A
function name:  f
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                         'Hellooo'
   10     1      > RETURN                                                       null

End of function f

End of class C1.

Class C2:
Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EYq8A
function name:  count
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                       null

End of function count

End of class C2.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
146.89 ms | 2083 KiB | 13 Q