Page 1 of 1
display the line number of the statement being executed
Posted: Wed Jan 14, 2004 5:14 am
by whacker
Help!!!
Is there a function or way a in php to display the line number of the current or last code or statement being executed aside from having an error???
Posted: Wed Jan 14, 2004 5:27 am
by twigletmac
Moved to the PHP - Code forum.
Mac
Posted: Wed Jan 14, 2004 5:30 am
by twigletmac
I'm a little confused by what you're asking? You can use __LINE__ to tell you what line you're on, e.g.:
Code: Select all
<?php
echo 'I am curently on line '.__LINE__;
echo '<br />';
echo 'Now I am on line '.__LINE__;
?>
outputs:
Code: Select all
I am curently on line 2
Now I am on line 8
Mac
Posted: Thu Jan 15, 2004 5:11 am
by whacker
Thank you. It solved my problem.
Forgive me if I have anohter question: How about the current php file executed even if it just an include file?
Posted: Thu Jan 15, 2004 6:32 am
by twigletmac
__FILE__
Mac