3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classes = get_declared_classes(); $implementsIface = array(); foreach($classes as $klass) { $reflect = new ReflectionClass($klass); if($reflect->implementsInterface('JsonSerializable')) $implementsIface [] = $klass; } print_r($implementsIface);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 16
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/EfW69
function name:  (null)
number of ops:  22
compiled vars:  !0 = $classes, !1 = $implementsIface, !2 = $klass, !3 = $reflect
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'get_declared_classes'
          1        DO_ICALL                                         $4      
          2        ASSIGN                                                   !0, $4
    3     3        ASSIGN                                                   !1, <array>
    4     4      > FE_RESET_R                                       $7      !0, ->17
          5    > > FE_FETCH_R                                               $7, !2, ->17
    5     6    >   NEW                                              $8      'ReflectionClass'
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !3, $8
    6    10        INIT_METHOD_CALL                                         !3, 'implementsInterface'
         11        SEND_VAL_EX                                              'JsonSerializable'
         12        DO_FCALL                                      0  $11     
         13      > JMPZ                                                     $11, ->16
    7    14    >   ASSIGN_DIM                                               !1
         15        OP_DATA                                                  !2
    4    16    > > JMP                                                      ->5
         17    >   FE_FREE                                                  $7
   10    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152 ms | 1395 KiB | 17 Q