• PHP Video Tutorials

PHP - Function error_get_last()



Syntax

array error_get_last ( void );

Definition and Usage

The function gets information about the last error that occurred.

Parameters

Sr.No Parameter & Description
1

void

NA.

Return Value

It returns an associative array describing the last error with keys "type", "message", "file" and "line". Returns NULL if there hasn't been an error yet.

Example

Following is the usage of this function −

<?php
   echo $b;
   print_r(error_get_last());
?> 

This will produce the following result −

Array (
   [type] => 8
   [message] => Undefined variable: a
   [file] => /var/www/tutorialspoint/php/test.php
   [line] => 2
)
php_function_reference.htm
Advertisements