php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9423 Please create a function that returns name of currently executing function
Submitted: 2001-02-23 10:54 UTC Modified: 2002-04-10 18:08 UTC
From: jide at lgb-inc dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jide at lgb-inc dot com
New email:
PHP Version: OS:

 

 [2001-02-23 10:54 UTC] jide at lgb-inc dot com
Please consider adding a new feature to the next version of PHP.

When creating code that reports errors, it would be very helpful
to have a function which returns the name of the currently
executing function (or class method).  You could perhaps
name the function "func_get_name()", which would fit in nicely
with the existing PHP functions "func_get_arg()", "func_get_args()",
and "func_num_args()".  Example usage:

function foo() {
           if ( some error condition ) {
                      ErrorHandler("An error occurrend in function " . func_get_name() );
           }
}

If there is another (existing) way to accomplish this, please let me know.
Thank you for your consideration (and thanks for PHP) -
Jim Ide         jide@lgb-inc.com

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-28 04:15 UTC] sander@php.net
Duplicate of 8576.
 [2002-04-10 18:08 UTC] sniper@php.net
Just added __FUNCTION__ and __CLASS__ constants.
These will be available in PHP 4.3.0.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC