php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #14302 self:: Accessing methods from within methods without an instance
Submitted: 2001-11-30 13:18 UTC Modified: 2001-12-02 00:11 UTC
From: ivan dot lamouret at novitek dot fr Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: any
Private report: No CVE-ID: None
 [2001-11-30 13:18 UTC] ivan dot lamouret at novitek dot fr
When inside a class method, there is no "denormalised" way to get at other methods "statically" i.e.:

class foo(){
function bar(){
// do not use $this;
}
function otherbar(){
foo::bar();//            <--- allow self::bar()
}
}

foo::otherbar();

If foo was an extension of some other class foobase, it could get at the foobase::methods with the "parent::" construct. In other words to get at my parent's method I do not need to know its name, but if I am not an instance I can not get at my own methods without giving my name. 

Since you can call a class method without an instance, this seems a natural extension of php's ::

Thank you all

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-02 00:11 UTC] zak@php.net
There will be significant changes to PHP OO support with 
the next version of the Zend Engine.

To get more information, visit:
http://www.zend.com/engine2/ZendEngine-2.0.pdf
http://www.zend.com/zend/zend-engine-summary.php
http://www.zend.com/zend/zengine/


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 18:01:34 2025 UTC