3v4l.org

run code in 300+ PHP versions simultaneously
<?php // It seems instanceof only supports checking for directly implemented interfaces, not inherited ones: interface FooBarInterface { } class Bar implements FooBarInterface { } class Foo extends Bar { } $className = Foo::class; var_dump($className instanceof FooBarInterface); var_dump(is_subclass_of($className, FooBarInterface::class)); var_dump(class_implements($className));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T2r6W
function name:  (null)
number of ops:  21
compiled vars:  !0 = $className
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'bar'
   11     1        DECLARE_CLASS                                            'foo', 'bar'
   14     2        ASSIGN                                                   !0, 'Foo'
   15     3        INIT_FCALL                                               'var_dump'
          4        INSTANCEOF                                       ~2      !0, 'FooBarInterface'
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                                 
   16     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'is_subclass_of'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'FooBarInterface'
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                                 
   17    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'class_implements'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $6      
         18        SEND_VAR                                                 $6
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Class FooBarInterface: [no user functions]
Class Bar: [no user functions]
Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.62 ms | 1399 KiB | 19 Q