Bluehost.com Web Hosting $6.95

Getting the Function name of the Calling Function- How ?

This is a discussion on Getting the Function name of the Calling Function- How ? within the PHP General forums, part of the PHP Programming Forums category; I guess the Subject is a little ambiguos. I want to get the function name which calls the target function. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-12-2007
Shyam Raj
 
Posts: n/a
Default Getting the Function name of the Calling Function- How ?

I guess the Subject is a little ambiguos. I want to get the function
name which calls the target function.

Like

function xxx()
{
....
....
yyy(2,3);

}

function zzz()
{
....
yyy(5,6);
.....

}

function yyy($a,$ab)
{
...
...
echo "yyy() has been called by the function - ".$functionname;

}

Now how can I get the name of the function tat calls yyy().

This will be really useful for Error logging purposes.

Reply With Quote
  #2 (permalink)  
Old 10-12-2007
ZeldorBlat
 
Posts: n/a
Default Re: Getting the Function name of the Calling Function- How ?

On Oct 12, 9:41 am, Shyam Raj <thanash...@gmail.com> wrote:
> I guess the Subject is a little ambiguos. I want to get the function
> name which calls the target function.
>
> Like
>
> function xxx()
> {
> ....
> ....
> yyy(2,3);
>
> }
>
> function zzz()
> {
> ....
> yyy(5,6);
> .....
>
> }
>
> function yyy($a,$ab)
> {
> ...
> ...
> echo "yyy() has been called by the function - ".$functionname;
>
> }
>
> Now how can I get the name of the function tat calls yyy().
>
> This will be really useful for Error logging purposes.


<http://www.php.net/debug_backtrace>

If you're using this for anything other than debugging or error
logging it suggests a problem with your code.

Reply With Quote
  #3 (permalink)  
Old 10-15-2007
Shyam Raj
 
Posts: n/a
Default Re: Getting the Function name of the Calling Function- How ?

Tnx a lot pal..

On Oct 12, 7:13 pm, ZeldorBlat <zeldorb...@gmail.com> wrote:
> On Oct 12, 9:41 am, Shyam Raj <thanash...@gmail.com> wrote:
>
>
>
> > I guess the Subject is a little ambiguos. I want to get the function
> > name which calls the target function.

>
> > Like

>
> > function xxx()
> > {
> > ....
> > ....
> > yyy(2,3);

>
> > }

>
> > function zzz()
> > {
> > ....
> > yyy(5,6);
> > .....

>
> > }

>
> > function yyy($a,$ab)
> > {
> > ...
> > ...
> > echo "yyy() has been called by the function - ".$functionname;

>
> > }

>
> > Now how can I get the name of the function tat calls yyy().

>
> > This will be really useful for Error logging purposes.

>
> <http://www.php.net/debug_backtrace>
>
> If you're using this for anything other than debugging or error
> logging it suggests a problem with your code.



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:05 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0