3v4l.org

run code in 500+ PHP versions simultaneously
<?php interface I { } class A implements I { } class B extends A { } $b = new B(); echo "B <-> I:\n"; var_dump($b instanceof I); var_dump(is_a($b, "I")); var_dump(is_subclass_of($b, "I")); $rc = new ReflectionClass("B"); var_dump($rc->getInterfaceNames()); echo "\n\nB <-> A:\n"; var_dump($b instanceof A); var_dump(is_a($b, "A")); var_dump(is_subclass_of($b, "A"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZQgJG
function name:  (null)
number of ops:  53
compiled vars:  !0 = $b, !1 = $rc
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                                'a'
    6     1        DECLARE_CLASS                                                'b', 'a'
    8     2        NEW                                                  $2      'B'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $2
    9     5        ECHO                                                         'B+%3C-%3E+I%3A%0A'
   10     6        INIT_FCALL                                                   'var_dump'
          7        INSTANCEOF                                           ~5      !0, 'I'
          8        SEND_VAL                                                     ~5
          9        DO_ICALL                                                     
   11    10        INIT_FCALL                                                   'var_dump'
         11        INIT_FCALL                                                   'is_a'
         12        SEND_VAR                                                     !0
         13        SEND_VAL                                                     'I'
         14        DO_ICALL                                             $7      
         15        SEND_VAR                                                     $7
         16        DO_ICALL                                                     
   12    17        INIT_FCALL                                                   'var_dump'
         18        INIT_FCALL                                                   'is_subclass_of'
         19        SEND_VAR                                                     !0
         20        SEND_VAL                                                     'I'
         21        DO_ICALL                                             $9      
         22        SEND_VAR                                                     $9
         23        DO_ICALL                                                     
   14    24        NEW                                                  $11     'ReflectionClass'
         25        SEND_VAL_EX                                                  'B'
         26        DO_FCALL                                          0          
         27        ASSIGN                                                       !1, $11
   15    28        INIT_FCALL                                                   'var_dump'
         29        INIT_METHOD_CALL                                             !1, 'getInterfaceNames'
         30        DO_FCALL                                          0  $14     
         31        SEND_VAR                                                     $14
         32        DO_ICALL                                                     
   17    33        ECHO                                                         '%0A%0AB+%3C-%3E+A%3A%0A'
   18    34        INIT_FCALL                                                   'var_dump'
         35        INSTANCEOF                                           ~16     !0, 'A'
         36        SEND_VAL                                                     ~16
         37        DO_ICALL                                                     
   19    38        INIT_FCALL                                                   'var_dump'
         39        INIT_FCALL                                                   'is_a'
         40        SEND_VAR                                                     !0
         41        SEND_VAL                                                     'A'
         42        DO_ICALL                                             $18     
         43        SEND_VAR                                                     $18
         44        DO_ICALL                                                     
   20    45        INIT_FCALL                                                   'var_dump'
         46        INIT_FCALL                                                   'is_subclass_of'
         47        SEND_VAR                                                     !0
         48        SEND_VAL                                                     'A'
         49        DO_ICALL                                             $20     
         50        SEND_VAR                                                     $20
         51        DO_ICALL                                                     
         52      > RETURN                                                       1

Class I: [no user functions]
Class A: [no user functions]
Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.56 ms | 2400 KiB | 16 Q