PHP Magic Constants __LINE__

Going through the php document I came across magic constant __LINE__.

-What this contants does?
returns the current Line No. of the file.

-How we can use this constant in development?
I started using this function for most of the debugging purposes. I simply append it with my echo messages. So when I need to go to code, I can directly go the same line.

I more magical constant I used along with __LINE__ is __FILE__. __FILE__ gives the name of the current script file name.

These two functions reduced 20% of my debugging time.

Advertisements

2 Responses to PHP Magic Constants __LINE__

  1. Ray, Montreal says:

    Thanks for the info. A fast Google search and here I am finding the information that I needed. 🙂

  2. Prakash says:

    Thanks for valubale info.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: