I am trying to create an error class and many error classes that I looked at in the past, use FILE and LINE to show where the error occurred, but they use them in the function, so they are always the same, which is extremely useless information. Besides sending an array containing FILE and LINE with each function (which can be pretty painful), I can't think of or find anything else. Is there a good way or function to determine the correct line number and the file from which the function was executed?
Example:
<?php
dosomething(false);
?>
<?php
function dosomething($input) {
if ($input === false) die("Error at Line (line) in File (file)");
}
?>
The function will die with the message "Error on line 3 in / file 1.php."