RE: [PHP] Line Number function?
| From: | Steven Balthazor | Date: | Sun, 02 Feb 2003 05:03:05 +0000 |
| Subject: | RE: [PHP] Line Number function? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133957@lists.php.net to get a copy of this message | ||
I think what you are looking for is:
__LINE__
See: http://www.php.net/manual/en/language.constants.predefined.php
Cheers,
Steven Balthazor
-----Original Message-----
From: Benjamin Smith [mailto:bens@effortlessis.com]
Sent: Saturday, February 01, 2003 8:59 PM
To: php-general@lists.php.net
Subject: [PHP] Line Number function?
PHP keeps track of what line# is being executed, so that when there's an
error (say in pg_exec() ) it reports what line the error occured on.
This appears to happen even during runtime (not just during compilation).
For example:
-------------------------
<?
$dbname="mydb";
$dbuser="myuser";
$dbpass="mypw";
$conn=pg_connect("dbname=$dbname, user=$dbuser, password=$dbpass");
$cmd="go and ask the mice";
$result=pg_exec($conn, $cmd);
?>
--------------------------
This would result in a pg_exec error ~ line 7. PHP tracks this, even though
the error is during runtime, not during the precompile.
Is there a function where I can access this information? Something like
"get_line();" or something?
This would be REALLY HANDY for debugging large projects...
-Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php