Copyright © tutorialspoint.com

PHP Function error_get_last()

previous
Advertisements

Syntax

array error_get_last ( void );

Definition and Usage

Thsi function gets information about the last error that occured.

Paramters

ParameterDescription
voidNA.

Return Value

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 $a;
print_r(error_get_last());
?> 

This will produce following result:

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

Copyright © tutorialspoint.com