<?php
/* - - - - - - - - - - - - - - - - -
Object oriented style
- - - - - - - - - - - - - - - - - */
arr|false public static DateTime::getLastErrors ( )
?>
<?php
/* - - - - - - - - - - - - - - - - -
Procedural style
- - - - - - - - - - - - - - - - - */
arr|false date_get_last_errors ( )
?>
<?php
$date01 = date_create(DateTimeInterface::RFC850);
$arrlerr01 = date_get_last_errors();
echo '<pre>';
print_r($arrlerr01);
echo '</pre>';
?>
<?php
$date02 = date_create(DateTimeInterface::RFC850);
$arrlerr02 = DateTime::getLastErrors();
echo 'Warnings: ' . $arrlerr02['warning_count'] . '<br>';
echo $arrlerr02['warnings'][3] . '<br>';
echo 'Errors: ' . $arrlerr02['error_count'] . '<br><br>';
for($i = 1; $i <= 20; $i++)
{
echo $i . ' - ' . @$arrlerr02['errors'][$i] . '<br>';
}
?>
<?php
$date03 = date_create(DateTimeInterface::RFC850);
$obj03 = new DateTime();
echo 'error:<br>';
$arr03 = $obj03->getLastErrors();
echo '<pre>';
print_r($arr03);
echo '</pre>';
?>
<?php
var_dump(date_get_last_errors());
// no date was parsed, so no errors
?>