3v4l.org

run code in 500+ PHP versions simultaneously
<?php /** * @psalm-param class-string $class * @psalm-return \Generator<class-string> */ function classTypes(string $class): \Generator { yield $class; yield from class_parents($class); yield from class_implements($class); } interface I1 {} interface I2 {} abstract class A implements I1 {} final class B extends A implements I2 {} var_dump(iterator_to_array(classTypes(B::class), false));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EOPjm
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   DECLARE_CLASS                                                'a'
   20     1        DECLARE_CLASS                                                'b', 'a'
   22     2        INIT_FCALL                                                   'var_dump'
          3        INIT_FCALL                                                   'iterator_to_array'
          4        INIT_FCALL                                                   'classtypes'
          5        SEND_VAL                                                     'B'
          6        DO_FCALL                                          0  $0      
          7        SEND_VAR                                                     $0
          8        SEND_VAL                                                     <false>
          9        DO_ICALL                                             $1      
         10        SEND_VAR                                                     $1
         11        DO_ICALL                                                     
         12      > RETURN                                                       1

Function classtypes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/EOPjm
function name:  classTypes
number of ops:  14
compiled vars:  !0 = $class
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        GENERATOR_CREATE                                             
    9     2        YIELD                                                        !0
   10     3        INIT_FCALL                                                   'class_parents'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $2      
          6        YIELD_FROM                                           ~3      $2
          7        FREE                                                         ~3
   11     8        INIT_FCALL                                                   'class_implements'
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                             $4      
         11        YIELD_FROM                                           ~5      $4
         12        FREE                                                         ~5
   12    13      > GENERATOR_RETURN                                             

End of function classtypes

Class I1: [no user functions]
Class I2: [no user functions]
Class A: [no user functions]
Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.31 ms | 2093 KiB | 18 Q