You are here: Re: PHP5 Object and Class Errors « PHP Programming Language « IT news, forums, messages
Re: PHP5 Object and Class Errors

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация