Re: getting a function name of the calling function
| From: | Joshua E Minnie | Date: | Thu, 02 May 2002 13:19:31 +0000 |
| Subject: | Re: getting a function name of the calling function | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95690@lists.php.net to get a copy of this message | ||
What I am trying to do is create an error message within in a string that
whenever each function fails it echos this particular string out with it's
pertinent information.
i.e.
<?
$error_string = "Warning: unable to complete query in ".__FUNCTION__."name
in ".__FILE__;
function some_funct($var) {
global $error_string;
//doing something
//error detected
echo $error_string;
}
?>
Does this sounds feasible or is there another way to generate a dynamic
error message without giving the user to much information about the error if
it occurs?
-josh
"Cc Zona" <email@cczona.com> wrote in message
news:email-722911.20311301052002@pb1.pair.com...
> In article <20020501200339.14611.qmail@pb1.pair.com>,
> josh@acsurf.net (Joshua E Minnie) wrote:
>
> > Does anybody know of any constants or predefined functions that will
> > retrieve the calling functions name? For example:
> >
> > <?
> > function new_func($somedata) {
> > echo "I am function ".get_func_name();
> > }
> > ?>
>
> What would be the point of this? How could you call the function to get
> the info without already having the info in the first place? If calling
> with a variable ("$foo();"), then you have the variable. If the call is
> hardcoded ("new_func();") then of course you know the name there too.
> Perhaps if you explained what you're trying to accomplish...
>
> --
> CC