3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = '28/5/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); var_dump($intlDateFormatter->parse($date)); var_dump($intlDateFormatter->getErrorMessage()); $intlDateFormatter->setLenient(true); var_dump($intlDateFormatter->parse($date)); var_dump($intlDateFormatter->getErrorMessage()); } $fmt = new IntlDateFormatter( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles', IntlDateFormatter::GREGORIAN, 'dd/MM/yyyy' ); echo 'lenient of the formatter is : '; if ($fmt->isLenient()) { echo 'TRUE'; } else { echo 'FALSE'; } $fmt->parse('35/13/1971'); echo "\n Trying to do parse('35/13/1971').\nResult is : " . $fmt->parse('35/13/1971');
Output for git.master, git.master_jit, rfc.property-hooks
string(10) "dd/MM/yyyy" int(75884400) string(12) "U_ZERO_ERROR" int(75884400) string(12) "U_ZERO_ERROR" string(5) "d/m/Y" int(61977900) string(12) "U_ZERO_ERROR" int(61977900) string(12) "U_ZERO_ERROR" lenient of the formatter is : TRUE Trying to do parse('35/13/1971'). Result is : 66038400

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.19 ms | 402 KiB | 8 Q