It is currently Thu Mar 28, 2024 4:01 am



Reply to topic  [ 3 posts ] 
Programmatically determine originating method? 
Author Message
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post Programmatically determine originating method?
ok... so... is there any way to programmatically determine the name of the method you're currently in, preferably with the values passed to it? So far I've figured out how to...

get the current class :: get_class($this) or get_class($instantiated_class);
get the current line number :: __LINE__

but not the method. If I could programmatically get the method too that would be COOLZ0R!

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Thu Jun 28, 2007 7:37 am
Profile WWW
Duke
User avatar

Joined: Mon Mar 31, 2003 8:59 am
Posts: 1358
Location: right behind you
Reply with quote
Post 
Yes, but not directly.

http://us2.php.net/manual/en/function.d ... ktrace.php

function getFunctionName() {
$backtrace = debug_backtrace();
return $backtrace[1]['function'];
}


Thu Jun 28, 2007 8:54 pm
Profile YIM WWW
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 
neat. Thanks.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Fri Jun 29, 2007 6:18 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.