3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function ($errno, $errstr) { global $errored; $errored = TRUE; return TRUE; }); $errored = FALSE; $excludedClasses = [ // These cause fatal errors on instantiation "Closure", "SQLite3", "Filter" ]; var_dump( array_filter( get_declared_classes(), function ($className) use (&$errored, $excludedClasses) { $errored = FALSE; foreach ($excludedClasses as $class) { if (substr($className, 0, strlen($class)) === $class) { return FALSE; } } if (!(new ReflectionClass($className))->hasMethod('__toString')) { try { $x = new $className; $x = (string)$x; return $errored; } catch (Exception $e) { return FALSE; } } return FALSE; } ) );

preferences:
47.37 ms | 402 KiB | 5 Q