3v4l.org

run code in 300+ PHP versions simultaneously
<?php function modifyIsValid(string $modify): bool { $date = new DateTime(); return (bool) @$date->modify($modify); } var_dump(modifyIsValid('+1 day')); var_dump(modifyIsValid('xxx'));
Output for 8.3.0 - 8.3.7
bool(true) Fatal error: Uncaught DateMalformedStringException: DateTime::modify(): Failed to parse time string (xxx) at position 0 (x): The timezone could not be found in the database in /in/nusfq:6 Stack trace: #0 /in/nusfq(6): DateTime->modify('xxx') #1 /in/nusfq(10): modifyIsValid('xxx') #2 {main} thrown in /in/nusfq on line 6
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19
bool(true) bool(false)

preferences:
55.81 ms | 402 KiB | 62 Q