PHP Tutorial : Get line number

As you might know, PHP Server comes with built-in / already defined constants. Today I’ve been discovering a nice one which gets the line number in a file for you. This may be very usefull in a lot of cases, like a custom error system, debugging and not only. That CONSTANT is called simply _LINE_

<?php

print __LINE__;
?>

This will print 3, because it’s line two!

This entry was posted in Usefull PHP and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>