3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = date_create_from_format('123', 'foo'); var_dump($date); $date = DateTime::createFromFormat('123', 'foo'); var_dump($date); $interval = date_interval_create_from_date_string('foo'); var_dump($interval); $interval = DateInterval::createFromDateString('foo'); var_dump($interval); $date = new DateTime(); $res = date_modify($date, 'foo'); var_dump($res); $res = $date->modify('foo'); var_dump($res);
Output for 8.3.0 - 8.3.6
bool(false) bool(false) Warning: date_interval_create_from_date_string(): Unknown or bad format (foo) at position 0 (f): The timezone could not be found in the database in /in/HjXee on line 8 bool(false) Fatal error: Uncaught DateMalformedIntervalStringException: Unknown or bad format (foo) at position 0 (f): The timezone could not be found in the database in /in/HjXee:10 Stack trace: #0 /in/HjXee(10): DateInterval::createFromDateString('foo') #1 {main} thrown in /in/HjXee on line 10
Process exited with code 255.
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
bool(false) bool(false) Warning: date_interval_create_from_date_string(): Unknown or bad format (foo) at position 0 (f): The timezone could not be found in the database in /in/HjXee on line 8 bool(false) Warning: DateInterval::createFromDateString(): Unknown or bad format (foo) at position 0 (f): The timezone could not be found in the database in /in/HjXee on line 10 bool(false) Warning: date_modify(): Failed to parse time string (foo) at position 0 (f): The timezone could not be found in the database in /in/HjXee on line 14 bool(false) Warning: DateTime::modify(): Failed to parse time string (foo) at position 0 (f): The timezone could not be found in the database in /in/HjXee on line 16 bool(false)

preferences:
93.88 ms | 403 KiB | 89 Q