3v4l.org

run code in 300+ PHP versions simultaneously
<?php $errored = FALSE; set_error_handler(function ($errno, $errstr) use (&$errored) { $errored = TRUE; return TRUE; }); $excludedClasses = [ // These cause fatal errors on instantiation "Closure", //"SQLite3", "Filter", "PDO" ]; var_dump( array_filter( get_declared_classes(), function ($className) use (&$errored, $excludedClasses) { $class = new ReflectionClass($className); if (!$class->isInstantiable() || $class->hasMethod('__construct') && (new ReflectionMethod("$className::__construct"))->isPrivate()) { return FALSE; } foreach ($excludedClasses as $bannedClass) { if (substr($className, 0, strlen($bannedClass)) === $bannedClass) { return FALSE; } } if (!(new ReflectionClass($className))->hasMethod('__toString')) { try { $errored = FALSE; $x = new $className; $x = (string)$x; return !$errored; } catch (Exception $e) { return FALSE; } } return FALSE; } ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eULeh
function name:  (null)
number of ops:  20
compiled vars:  !0 = $errored, !1 = $excludedClasses
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <false>
    5     1        INIT_FCALL                                               'set_error_handler'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeULeh%3A5%240'
          3        BIND_LEXICAL                                             ~3, !0
          4        SEND_VAL                                                 ~3
          5        DO_ICALL                                                 
    7     6        ASSIGN                                                   !1, <array>
   14     7        INIT_FCALL                                               'var_dump'
   15     8        INIT_FCALL                                               'array_filter'
   16     9        INIT_FCALL                                               'get_declared_classes'
         10        DO_ICALL                                         $6      
         11        SEND_VAR                                                 $6
   17    12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeULeh%3A17%241'
         13        BIND_LEXICAL                                             ~7, !0
         14        BIND_LEXICAL                                             ~7, !1
   39    15        SEND_VAL                                                 ~7
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                                 
   41    19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FeULeh%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eULeh
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errored
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        ASSIGN                                                   !2, <true>
          4      > RETURN                                                   <true>
          5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeULeh%3A5%240

Function %00%7Bclosure%7D%2Fin%2FeULeh%3A17%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 11, Position 2 = 24
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 39
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 39
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 38
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 60
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
Branch analysis from position: 23
Branch analysis from position: 24
Found catch point at position: 58
Branch analysis from position: 58
2 jumps found. (Code = 107) Position 1 = 59, Position 2 = -2
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eULeh
function name:  {closure}
number of ops:  62
compiled vars:  !0 = $className, !1 = $errored, !2 = $excludedClasses, !3 = $class, !4 = $bannedClass, !5 = $x, !6 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   18     3        NEW                                              $7      'ReflectionClass'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !3, $7
   19     7        INIT_METHOD_CALL                                         !3, 'isInstantiable'
          8        DO_FCALL                                      0  $10     
          9        BOOL_NOT                                         ~11     $10
         10      > JMPNZ_EX                                         ~11     ~11, ->24
         11    >   INIT_METHOD_CALL                                         !3, 'hasMethod'
         12        SEND_VAL_EX                                              '__construct'
         13        DO_FCALL                                      0  $12     
         14      > JMPZ_EX                                          ~13     $12, ->23
         15    >   NEW                                              $14     'ReflectionMethod'
         16        NOP                                                      
         17        FAST_CONCAT                                      ~15     !0, '%3A%3A__construct'
         18        SEND_VAL_EX                                              ~15
         19        DO_FCALL                                      0          
         20        INIT_METHOD_CALL                                         $14, 'isPrivate'
         21        DO_FCALL                                      0  $17     
         22        BOOL                                             ~13     $17
         23    >   BOOL                                             ~11     ~13
         24    > > JMPZ                                                     ~11, ->26
   20    25    > > RETURN                                                   <false>
   22    26    > > FE_RESET_R                                       $18     !2, ->39
         27    > > FE_FETCH_R                                               $18, !4, ->39
   23    28    >   INIT_FCALL                                               'substr'
         29        SEND_VAR                                                 !0
         30        SEND_VAL                                                 0
         31        STRLEN                                           ~19     !4
         32        SEND_VAL                                                 ~19
         33        DO_ICALL                                         $20     
         34        IS_IDENTICAL                                             !4, $20
         35      > JMPZ                                                     ~21, ->38
   24    36    >   FE_FREE                                                  $18
         37      > RETURN                                                   <false>
   22    38    > > JMP                                                      ->27
         39    >   FE_FREE                                                  $18
   28    40        NEW                                              $22     'ReflectionClass'
         41        SEND_VAR_EX                                              !0
         42        DO_FCALL                                      0          
         43        INIT_METHOD_CALL                                         $22, 'hasMethod'
         44        SEND_VAL_EX                                              '__toString'
         45        DO_FCALL                                      0  $24     
         46        BOOL_NOT                                         ~25     $24
         47      > JMPZ                                                     ~25, ->60
   30    48    >   ASSIGN                                                   !1, <false>
   31    49        FETCH_CLASS                                   0  $27     !0
         50        NEW                                              $28     $27
         51        DO_FCALL                                      0          
         52        ASSIGN                                                   !5, $28
   32    53        CAST                                          6  ~31     !5
         54        ASSIGN                                                   !5, ~31
   33    55        BOOL_NOT                                         ~33     !1
         56      > RETURN                                                   ~33
         57*       JMP                                                      ->60
   34    58  E > > CATCH                                       last         'Exception'
   35    59    > > RETURN                                                   <false>
   38    60    > > RETURN                                                   <false>
   39    61*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeULeh%3A17%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.31 ms | 1404 KiB | 23 Q