|
Posted by Oli Filth on 11/18/44 11:44
Nate said the following on 09/04/2006 02:03:
> class TestClass
> {
> public function list(){
> echo 'list';
> }
> }
>
> `list` is a built in PHP method, so by declaring it in an object, it
> violates the global namespace.
list() is actually not a function/method, but a language construct, and
as such, doesn't belong to any namespace.
Use of language constructs as method names is not allowed, however, use
of "global" function names is, replace your "list" example with "count",
for example.
> php won't complain about this method
> being in the class,
Yes it does, if you have errors set appropriately. With E_ALL, I get
the following message:
Parse error: parse error, unexpected T_LIST, expecting T_STRING ...
--
Oli
Navigation:
[Reply to this message]
|