3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateofbirth = '30/11/80'; $date = DateTime::createFromFormat('d/m/Y', $dateofbirth); $date_errors = DateTime::getLastErrors(); if ($date_errors['warning_count'] + $date_errors['error_count'] > 0) { echo 'Date '.$dateofbirth.' is not a valid DD/MM/YYYY format.'; } else { echo $date->format('Y-m-d'); }
Output for 8.3.0 - 8.3.6
Warning: Trying to access array offset on false in /in/CKlS5 on line 6 Warning: Trying to access array offset on false in /in/CKlS5 on line 6 0080-11-30
Output for 8.2.0 - 8.2.18
Warning: Trying to access array offset on value of type bool in /in/CKlS5 on line 6 Warning: Trying to access array offset on value of type bool in /in/CKlS5 on line 6 0080-11-30
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
0080-11-30

preferences:
279.74 ms | 404 KiB | 415 Q