You are here: Re: Accessing arrays returned from functions « PHP Programming Language « IT news, forums, messages
Re: Accessing arrays returned from functions

Posted by Erwin Moller on 03/28/07 13:05

rick@fourfront.ltd.uk wrote:

> I was led to believe that it was possible to access an array returned
> from a function in php5 without first assigning it to a variable as
> follows ;-
>
> ...
> function setArr()
> {
> return array( 1, 2, 3, 4, 5 ) ;
> }
>
> echo setArr()[ 3 ] ;
>
>
> However this does not work - it just produces a parse error.
> Have I been mis-informed or am I doing it wrong ?

Hi,

I asked the same question some time ago and was told it is not possible tat
way.
But assigning it to an array will not force a copy of the array, so the
overhead involved is minimal.
So as far as I know you were informed wrong.

Regards,
Erwin Moller

> TIA

 

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

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