473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

name of the calling method

Hi,

I'd like to get the name of the calling method. I can't find the solution.
For example :

function MyFct()
{
return TheOtherFct() ;
}

function TheOtherFct()
{
echo "Hi, the calling method is ..." ;
return true ;
}

MyFct() ;
Thank you for your help,

gizz
May 8 '07 #1
4 2135
"gizz" <gi**@nospam.orgwrote in message
news:46*********************@news.free.fr...
Hi,

I'd like to get the name of the calling method. I can't find the solution.
For example :

function MyFct()
{
return TheOtherFct() ;
}

function TheOtherFct()
{
print_r(debug_backtrace()); // It's in there somewhere
echo "Hi, the calling method is ..." ;
return true ;
}

MyFct() ;
see http://fi2.php.net/debug_backtrace for documentation

--
Ra*********@gmail.com

"Good tea. Nice house." -- Worf
May 8 '07 #2
gizz wrote:
Hi,

I'd like to get the name of the calling method. I can't find the solution.
For example :

function MyFct()
{
return TheOtherFct() ;
}

function TheOtherFct()
{
echo "Hi, the calling method is ..." ;
return true ;
}

MyFct() ;
Hi, just check if the output of debug_backtrace fullfill your expectations.

hth,
Roy
May 8 '07 #3
function TheOtherFct()
{
echo "Hi, the calling method is ..." ;
return true ;
}
MyFct() ;
Under Foxpro, u could use program().
--
iTech Consulting Services Limited
Expert in ePOS (Point-Of-Sales) solutions
Website: http://www.itech.com.hk (IE only)
Tel: (852)2325 3883 Fax: (852)2325 8288
May 8 '07 #4
thanks you all for your help, the debug_backtrace function is exactly what i
was searching for.
gizz
May 8 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Matt Clepper | last post by:
Any way to do this? I need to call functions based on a variable. Do I actually have to make a case statement and call each funciton explicitly, or is there any way to call a function where the...
2
by: Tony Liu | last post by:
Hi, I want to get the name of the calling function of an executing function, I use the StackTrace class to do this and it seems working. However, does anyone think that there any side effect...
4
by: Hmnt | last post by:
Hi Hope ur smart enough to get what i wanna ask ... (from the sub line Brief Explaination I've 2 classas Class1 and Class Now i've an instance of Class2 ( Class2 objC2 = new Class2(); Next i...
14
by: Altman | last post by:
Ok I have a control that is inherited from another class. In the child I put msgbox(me.name) in the load event. What always pops up is the name of the parent class and not the name of the...
2
by: Don | last post by:
This may seem like an odd question, but is it possible to get the name of the class & function that is calling a function of another class? e.g. Public Class CallerName Public Shared Function...
4
by: ssg31415926 | last post by:
I want to write a logging method. I want it to log the name of the calling class and method. Is there any way to do this? I presume it'll use Reflection but it's not an area I've used much.a ...
9
by: | last post by:
Is it possible to get the name of the method that the code is currently executing in so that I can pass it to another method? For example, in void method1() I will call void method5(). In method5...
1
by: developing | last post by:
Hey all , Is there a way to get the instance name at runtime? I had homework assignment to calculate great circle distance between two cities and a few conversions....Im done them all...except: ...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
by: Emile van Sebille | last post by:
mercado mercado wrote: Well, the class name is in __class__ so changing 'print x' to 'print __class__' will show foo in both cases, which is in fact the name of the class which is calling it....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.