php8.5
Home/ Manual/ predefined / error/ Error::getFile

Error::getFile

PHP function Edit on GitHub ✎

(PHP 7, PHP 8)

Gets the file in which the error occurred

Description

Error::getFile(): string

Get the name of the file the error occurred.

Parameters Parameters

Return Values

Returns the filename in which the error occurred.

Examples

Error::getFile() example

php
<?php
try {
    throw new Error;
} catch(Error $e) {
    echo $e->getFile();
}
?>

The above example will output something similar to:

output
/home/bjori/tmp/ex.php

See Also

  • Throwable::getFile

Source: language/predefined/error/getfile.xml · from the official PHP manual (php/doc-en)