Re: __invokeStatic() method
| From: | Patrick Schaaf | Date: | Tue, 19 Mar 2013 08:13:08 +0000 |
| Subject: | Re: __invokeStatic() method | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66697@lists.php.net to get a copy of this message | ||
On Tuesday 19 March 2013 02:54:19 Bruno CHALOPIN wrote:
> Now I don't see why in the world a class and a function could share the same
name.
Well, for one, I might have code like this:
class Foo {
public static the_usual() {
static $instance;
if (!isset($instance)) $instance = new Foo();
return $instance;
}
}
function Foo() {
Foo::the_usual();
}
.....
> Regarding conventions, a class name should begin with an uppercase character
and a function a lowercase one.
That' s a convention. That means that noone has to adhere to it. I don't.
> I don't see any relevant use case where a class
> and a function should share the same name.
Don't let yourself be limited by your imagination.
best regards
Patrick