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->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 { $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/GgYLj
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%2FGgYLj%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%2FGgYLj%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%2FGgYLj%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GgYLj
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%2FGgYLj%3A5%240

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.27 ms | 1404 KiB | 23 Q