3v4l.org

run code in 300+ PHP versions simultaneously
<?php class_alias('Datetime', 'DT'); $d = new DT(); var_dump($d);
Output for 8.3.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2022-11-15 02:25:02.007208" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2022-11-15 02:25:02.007367" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2022-11-15 02:25:02.009017" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.3
object(DateTime)#1 (3) { ["date"]=> string(26) "2022-11-15 02:25:02.007066" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.2
object(DateTime)#1 (3) { ["date"]=> string(26) "2022-11-15 02:25:02.003704" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2022-11-15 02:25:02.003806" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.3.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2022-11-15 02:25:02.003727" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 8.1.12 - 8.1.27, 8.2.10 - 8.2.18
Fatal error: Uncaught ValueError: class_alias(): Argument #1 ($class) must be a user-defined class name, internal class name given in /in/m2clO:3 Stack trace: #0 /in/m2clO(3): class_alias('Datetime', 'DT') #1 {main} thrown in /in/m2clO on line 3
Process exited with code 255.

preferences:
57.61 ms | 402 KiB | 27 Q