php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #4703 New "get_current_class" PHP Function
Submitted: 2000-05-30 20:34 UTC Modified: 2000-05-30 20:37 UTC
From: joel at nextstudio dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.0 Release OS: Linux 2.2.12
Private report: No CVE-ID: None
 [2000-05-30 20:34 UTC] joel at nextstudio dot com
Any chance in adding the Java equivalent of the
getClass().getName() methods?  Say maybe "get_current_class" and "get_current_object"? It'd be nice to see what the class and object names are within a method without having to explicitly pass the value to a constructor or method.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-30 20:37 UTC] andrei at cvs dot php dot net
Spending 2 minutes with a test script yields the following:

class foo {
    function foo() {
        print get_class($this);
    }
}

$a = new foo;

$this is get_current_object()
get_class($this) is get_current_class()

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 14:00:01 2026 UTC