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) { $errored = FALSE; $class = new ReflectionClass($className); if ($class->hasMethod('__construct')) { $constructor = $class->getMethod('__construct'); $constructor->setAccessible(true); } if (!$class->isInstantiable()) { return FALSE; } foreach ($excludedClasses as $bannedClass) { if (substr($className, 0, strlen($bannedClass)) === $bannedClass) { return FALSE; } } if (!(new ReflectionClass($className))->hasMethod('__toString')) { try { $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/FRnsE
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%2FFRnsE%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%2FFRnsE%3A17%241'
         13        BIND_LEXICAL                                             ~7, !0
         14        BIND_LEXICAL                                             ~7, !1
   43    15        SEND_VAL                                                 ~7
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                                 
   45    19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FFRnsE%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FRnsE
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%2FFRnsE%3A5%240

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.17 ms | 1404 KiB | 23 Q