3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classes = get_declared_classes(); foreach ( $classes as $clazz ) { $r = new ReflectionClass( $clazz ); if ( !$r->isInstantiable() ) { continue; } try { new $clazz(); } catch ( ArgumentCountError|TypeError $e ) { // Nothing } catch ( Throwable $e ) { echo $clazz . ": "; echo get_class( $e ) . ': ' . $e->getMessage() . "\n"; } }
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.14
Generator: Error: The "Generator" class is reserved for internal use and cannot be manually instantiated WeakReference: Error: Direct instantiation of WeakReference is not allowed, use WeakReference::create instead FiberError: Error: The "FiberError" class is reserved for internal use and cannot be manually instantiated InflateContext: Error: Cannot directly construct InflateContext, use inflate_init() instead DeflateContext: Error: Cannot directly construct DeflateContext, use deflate_init() instead PDORow: PDOException: You may not create a PDORow manually XMLParser: Error: Cannot directly construct XMLParser, use xml_parser_create() or xml_parser_create_ns() instead

preferences:
71.14 ms | 408 KiB | 5 Q