DateTimeImmutable::getLastErrors
  (PHP 5 >= 5.5.0, PHP 7, PHP 8)
DateTimeImmutable::getLastErrors — Devuelve las advertencias y errores
  
 
  Descripción
  
   public static DateTimeImmutable::getLastErrors(): 
array|false 
  
  
 
  Parámetros
  Esta función no contiene ningún parámetro.
  
 
  Valores devueltos
  
   Devuelve un array que contiene información sobre advertencias y errores, o false si no
   hay ni advertencias ni errores.
  
  
 
 
  Ejemplos
  
   Ejemplo #1 DateTimeImmutable::getLastErrors() example
   
<?php
try {
    $date = new DateTimeImmutable('asdfasdf');
} catch (Exception $e) {
    // Solo para fines de demostración...
    print_r(DateTimeImmutable::getLastErrors());
    // La forma correcta de hacer esto con programación orientada a objetos es
    // echo $e->getMessage();
}
?>
    
   Los ejemplos anteriores mostrarán:
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
       )
)
 
   
    Los índices 6, y 0 en la salida de ejemplo se refieren al índice de caracteres en la cadena donde ocurrió el error.