3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = DateTime::createFromFormat('Y-m-d', '1990-49-85'); var_dump($a); $b = new DateTime('2025-11-31'); var_dump($b); $c = new DateTime('1990-49-85'); var_dump($c);
Output for 8.3.5 - 8.3.30, 8.4.5 - 8.4.18, 8.5.0 - 8.5.3
object(DateTime)#1 (3) { ["date"]=> string(26) "1994-03-26 23:43:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2025-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (1990-49-85) at position 6 (9): Unexpected character in /in/W2fSu:11 Stack trace: #0 /in/W2fSu(11): DateTime->__construct('1990-49-85') #1 {main} thrown in /in/W2fSu on line 11
Process exited with code 255.
Output for 8.1.34, 8.2.28 - 8.2.30
object(DateTime)#1 (3) { ["date"]=> string(26) "1994-03-26 23:43:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#2 (3) { ["date"]=> string(26) "2025-12-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Fatal error: Uncaught Exception: Failed to parse time string (1990-49-85) at position 6 (9): Unexpected character in /in/W2fSu:11 Stack trace: #0 /in/W2fSu(11): DateTime->__construct('1990-49-85') #1 {main} thrown in /in/W2fSu on line 11
Process exited with code 255.

preferences:
49.02 ms | 656 KiB | 4 Q