- var_dump: documentation ( source)
<?php
$date = '28/05/1972';
$formats = [
'dd/MM/yyyy',
'd/m/Y',
];
foreach ($formats as $format) {
$intlDateFormatter = new IntlDateFormatter(
'it_IT',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Rome',
IntlDateFormatter::GREGORIAN,
$format
);
$intlDateFormatter->setLenient(false);
$intlDateFormatter->parse($date);
var_dump($intlDateFormatter->getErrorMessage());
$intlDateFormatter->setLenient(true);
$intlDateFormatter->parse($date);
var_dump($intlDateFormatter->getErrorMessage());
}