You are here: Re: php equivalent to printf("%d\n",__LINE__); « PHP Programming Language « IT news, forums, messages
Re: php equivalent to printf("%d\n",__LINE__);

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация