3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = '28/05/1972'; $formats = [ 'dd/MM/yyyy', 'd/m/Y', ]; foreach ($formats as $format) { var_dump($format); $intlDateFormatter = new IntlDateFormatter( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles', IntlDateFormatter::GREGORIAN, $format ); $intlDateFormatter->setLenient(false); $intlDateFormatter->parse($date); var_dump($intlDateFormatter->getErrorMessage()); $intlDateFormatter->setLenient(true); $intlDateFormatter->parse($date); var_dump($intlDateFormatter->getErrorMessage()); }
based on USQkY
Output for 5.4.11 - 5.4.45, 5.6.0 - 7.3.1
string(10) "dd/MM/yyyy" string(12) "U_ZERO_ERROR" string(12) "U_ZERO_ERROR" string(5) "d/m/Y" string(12) "U_ZERO_ERROR" string(12) "U_ZERO_ERROR"
Output for 5.5.0 - 5.5.38
string(10) "dd/MM/yyyy" Fatal error: Class 'IntlDateFormatter' not found in /in/P8MAs on line 11
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/P8MAs on line 4
Process exited with code 255.