3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo {}; class Bar extends Foo {}; function testClass($class=Foo::class) { $reflection = new ReflectionClass($class); return $class->isSubclassOf(Foo::class); } var_dump(testClass(), testClass(Bar::class));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TuAhe
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'testclass'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        INIT_FCALL                                               'testclass'
          5        SEND_VAL                                                 'Bar'
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function testclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TuAhe
function name:  testClass
number of ops:  10
compiled vars:  !0 = $class, !1 = $reflection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                        !0      'Foo'
    7     1        NEW                                              $2      'ReflectionClass'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $2
    9     5        INIT_METHOD_CALL                                         !0, 'isSubclassOf'
          6        SEND_VAL_EX                                              'Foo'
          7        DO_FCALL                                      0  $5      
          8      > RETURN                                                   $5
   10     9*     > RETURN                                                   null

End of function testclass

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.53 ms | 1397 KiB | 17 Q