ID:               21515
 Updated by:       [EMAIL PROTECTED]
-Summary:          Show the current functionname
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: all
 PHP Version:      4.3.0
 New Comment:

__FUNCTION__ is now documented as per bug #19196.  

Am changing the topic of this bug report to reflect everyones deep
desire for debug_backtrace() to be documented.  

We all agreed that the section on "Error Handling and Logging
Functions" is the best place for debug_backtrace.


Previous Comments:
------------------------------------------------------------------------

[2003-01-08 11:22:35] [EMAIL PROTECTED]

You can use the __FUNCTION__ constant as of PHP 4.3.0  It's documented
somewhere with the other magical sorta-constants __FILE__, __LINE__,
and __CLASS__.  __CLASS__ also became available in PHP 4.3.0

I think there's a bug somewhere for documented these sorta-constants as
the manual doesn't document them very well.

------------------------------------------------------------------------

[2003-01-08 04:27:05] [EMAIL PROTECTED]

hah, nu even de daad by het woord voegen :-)

------------------------------------------------------------------------

[2003-01-08 04:26:25] [EMAIL PROTECTED]

You can use debug_backtrace() for this (which is new in PHP 4.3.0).
(Try var_dump(debug_backtrace()); to see what output it gives), marking
this bug as a doc problem, as debug_backtrace() has not been documented
yet.

Derick

------------------------------------------------------------------------

[2003-01-08 04:20:36] [EMAIL PROTECTED]

Is it possible to create a getCurrentFunctionName() function?

If an user defined error occured (for example: you are not getting a
valid SQL-resultset with your query) in a function, it would be handy
to show the functionname where the error is generated.

Possible example:


function getQueryResultSet() {
 // requested code
 $currentFunctionName = getCurrentFunctionName();
 $query="select * from table";
 $result = mysql_query($query) or die ("The error occured in ".
$currentFunctionName);
 return $result;
}

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=21515&edit=1


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to