3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CollatorExt extends Collator { public static function create($locale) { return new self(); } } try { $collExt = CollatorExt::create('de_DE'); //object(CollatorExt) } catch (\Throwable | \Error $t) { echo 'an error occured'; }
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.13
Deprecated: Return type of CollatorExt::create($locale) should either be compatible with Collator::create(string $locale): ?Collator, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/29E2p on line 5 an error occured
Output for 7.4.0 - 7.4.32, 8.0.1 - 8.0.30
an error occured
Output for 7.4.33
Fatal error: Uncaught Error: Class 'Collator' not found in /in/29E2p:3 Stack trace: #0 {main} thrown in /in/29E2p on line 3
Process exited with code 255.

preferences:
120.07 ms | 408 KiB | 5 Q