PHP Australia Conference 2015

Exception::getLine

(PHP 5 >= 5.1.0)

Exception::getLineخط ایجاد کننده استثنا را می‌یابد

Description

final public int Exception::getLine ( void )

شماره خط تولید کننده استثنا را باز می‌گرداند.

Parameters

This function has no parameters.

Return Values

شماره خط تولید کننده استثنا را باز می‌گرداند.

Examples

Example #1 نمونه Exception::getLine()

<?php
try {
    throw new 
Exception("Some error message");
} catch(
Exception $e) {
    echo 
"The exception was thrown on line: " $e->getLine();
}
?>

The above example will output something similar to:

The exception was thrown on line: 3

add a note add a note

User Contributed Notes 1 note

up
1
James
3 years ago
Note that it appears to be the line number the Exception was created that is returned, *not* the line it was thrown from.

See this bug:
http://bugs.php.net/bug.php?id=53882

Wanted to note that here until documentation is fixed or bug report dealt with.
To Top