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); $constructor = $class->getMethod('__construct'); $constructor->setAccessible(true); if (!$class->isInstantiable() || $class->hasMethod('__construct') && $constructor->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/5hmho
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%2F5hmho%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%2F5hmho%3A17%241'
         13        BIND_LEXICAL                                             ~7, !0
         14        BIND_LEXICAL                                             ~7, !1
   41    15        SEND_VAL                                                 ~7
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                                 
   43    19      > RETURN                                                   1

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

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.65 ms | 1404 KiB | 23 Q