[PHP] getting a function name of the calling function
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(); } ? -josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getting a function name of the calling function
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(); } ? I don't believe there is anything setup to pass the name of a parent function to a child function. However you could always pass the parent function's name to the child function as a normal parameter. Sincerely, Craig Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting a function name of the calling function
I actually need it to print out the name of itself for error detection purposes. 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(); } ? This example should print out: I am function new_func Is this possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getting a function name of the calling function
I actually need it to print out the name of itself for error detection purposes. 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(); } ? This example should print out: I am function new_func Is this possible? No, not with any PHP function I see in the manual. Can you explain why you need to do this? You can call a function name with a variable. Like for your example $variable = new_func; $variable(data); That'll work. Explain what your trying to do and we can probably help you find a better approach. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting a function name of the calling function
I don't know of a way to print out the function name. But for error detection purposes, can you use __FILE__ and __LINE__ as alternatives? For example: echo I am line . __LINE__ . at file . __FILE__ . \n; Brian Joshua E Minnie [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I actually need it to print out the name of itself for error detection purposes. 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(); } ? This example should print out: I am function new_func Is this possible? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php