If there a way to get the name of the current function? For example,
assume $ErrorList is an object I created to handle all my errors. When an
error takes place, I add the error info to the $ErrorList object, and I
can later use that object for reporting to the user, or to a log file.
<?php
function getSomeData($var1, $var2) { // lines of code // … if ($var1
== “”) { // THIS IS WHERE I WANT THE FUNCTION NAME:
$ErrorList->Add(“Var1 must be specified!”, “<FUNCTION_NAME> LINE”); } }
?>
Having the function name would be very useful for tracking down bugs.
(we’re talking about a codebase of 200,000 lines)
On Friday 21 December 2001 11:07 am, Mike King wrote:
> > If there a way to get the name of the current function? For example, > assume $ErrorList is an object I created to handle all my errors. When > an error takes place, I add the error info to the $ErrorList object, and > I can later use that object for reporting to the user, or to a log file. > > <?php > > function getSomeData($var1, $var2) { // lines of code // … if ($var1 > == “”) { // THIS IS WHERE I WANT THE FUNCTION NAME: > $ErrorList->Add(“Var1 must be specified!”, "<FUNCTION_NAME> > LINE"); } } > > ?>
$ErrorList->Add(“Var1 must be specified!”, “<getSomeData> LINE”);