You are here: Re: Array property of object with __get and __set - is this a bug? « PHP « IT news, forums, messages
Re: Array property of object with __get and __set - is this a bug?

Posted by Oli Filth on 10/19/15 11:31

ZeldorBlat said the following on 07/11/2005 14:34:
> Not really a bug..more a difference in the way __get and __set are
> handled. Remember that when you use these, something like:
>
> $x = $obj->y
>
> does something slightly different than what you expect. Consider the
> following:
>
> function makeArray() {
> $r = array(1, 2, 3, 4);
> return $r;
> }
>
> Could you then write something like this:
>
> echo makeArray()[2];
>
> No, because makeArray is a function, not a reference or variable.

Actually, this is a limitation of PHP. In C, C++, C# and Java, the
equivalent of the above code works fine.



--
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

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