Google News
logo
PHP program to print the line number using __LINE__ magic constant
In the following example of PHP program that uses the `__LINE__` magic constant to print the current line number :
Program :
<?php
echo "The current line number is " . __LINE__ . ".\n";
echo "This is on line " . __LINE__ . ".\n";
?>
Output :
The current line number is 2.
This is on line 3.
Note that the `__LINE__` constant is replaced with the current line number at runtime.