php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #17743 Implementation of __FUNC__ and __CLASS__
Submitted: 2002-06-13 10:04 UTC Modified: 2002-06-14 06:01 UTC
From: stewart at nameless-uk dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.2.1 OS: n/a
Private report: No CVE-ID: None
 [2002-06-13 10:04 UTC] stewart at nameless-uk dot com
Hi,

Basically, this would follow along the same lines as __FILE__ and __LINE__, these macros would return the current function and class -- especially usefull for quick debugging of inherited classes.

It would also be incredibly usefull to be able to get the details of the calling function, perhaps via __CALLING_*__, just to make add a more professional edge to custom classes.

Keep up the good work!

Stewart.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-13 10:12 UTC] sniper@php.net
These already exist in PHP 4.3.0-dev:

NEWS:

- Added __FUNCTION__ and __CLASS__ constants. (Jani, Zend Engine)

 [2002-06-14 05:54 UTC] stewart at nameless-uk dot com
Ok, __FUNC__ and __CLASS__ are in, but what about the details of the calling context?

Stewart.
 [2002-06-14 06:01 UTC] derick@php.net
ZE2 has this kind of functionality with debug_backtrace(), for PHP 4.1.2 - 4.3.0de) you can use the xdebug extension from http://www.jdimedia.nl/derick/xdebug.php

Derick
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Jun 18 06:00:02 2026 UTC