Web | This Site

Learning PHP
Advanced PHP
PHP Function Reference
PHP Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# PHP Function error_get_last()

## Syntax

    array error_get_last ( void );

## Definition and Usage

Thsi function gets information about the last error that occured.

## Paramters

Parameter | Description
--- | ---
void | NA.

## 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
    )

Advertisement

Online Image Processing

Indian Baby Names