|
Posted by axlq on 01/31/08 23:50
In article <8cafc0ed-306b-405f-b9bc-94f8f7d4b116@i3g2000hsf.googlegroups.com>,
salmobytes <Sandy.Pittendrigh@gmail.com> wrote:
>In C you can make debug statments that announce the current
>line number in the source, with something like:
> printf("%d\n",__LINE__);
>
>php (if php.ini is setup that way) often announces
>line numbers when catching errors.
>
>How can you do echo the equivalent of C's __LINE__ macro
>on non-error but interesting debugging conditions?
Easy, just use __LINE__. Surprised?
I use the __FILE__, __FUNCTION__, and __LINE__ constantly in my php
code, especially with database queries, which often go awry while
developing a web site. I have multiple class libraries and code
modules. All my database queries are handled by a 'SQL_operations'
class, and every method gets __FILE__, __FUNCTION__, and __LINE__
passed to it, so if any error occurs, I am emailed the details.
-A
Navigation:
[Reply to this message]
|