I'm not trying to number the lines...
Let's say you have a big, huge pile of code.
Let's say that input validation failed somewhere,
and you want to track it down.
Wouldn't it be nice to know exactly where the
error occured?
<?
Function Error($linemsg, $error)
{
$fp=fopen('error.log', 'a');
fwrite($fp, "$linemsg - $error\n");
fclose($fp);
return true;
}
<!-- SNIP 10,000 LINES OF CODE -->
if ($a!='somethingexpected')
error(GetLineNumber(), 'A is unexpected!');
<!-- SNIP 3,300 MORE LINES OF CODE -->
?>
and if $a is unexpected, get a log entry like:
File: /usr/bin/bigandnasty.php Line: 10,002 - A is unexpected!
Although I'd never have that many lines of code
in a single file, this would at least allow me to know where
to look!
Any ideas?