date_get_last_errors

It returns the warnings and errors and is an alias of DateTime::getLastErrors().
Example

<?php
echo “<pre>”;
$date = date_create(‘phpcodez’);
print_r(date_get_last_errors());
?>

Output

Array
(
[warning_count] => 1
[warnings] => Array
(
[6] => Double timezone specification
)

[error_count] => 1
[errors] => Array
(
[0] => The timezone could not be found in the database
)

)

Share