3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createDateFromFormat($format, $time) { $result = \DateTimeImmutable::createFromFormat($format, $time); var_dump(\DateTime::getLastErrors()); return $result; } var_dump(\DateTimeImmutable::createFromFormat('Y-m-d|', '2000-15-0')); $errors = \DateTime::getLastErrors(); var_dump(\DateTime::getLastErrors()); if (!empty($errors['warning_count'])) { return false; }

preferences:
43.45 ms | 402 KiB | 5 Q