|
Posted by pangea33 on 11/22/06 05:44
windandwaves wrote:
> Hi Folk
>
> If I have myfunction() {
> return array();
> }
>
> then can I write
>
> echo myfunction()[0];
>
> I tried that, and I can not, but is there a way or do I have to write
> $myvar = myfunction();
> echo $myvar[0];
>
> TIA
>
> >nicolaas
The answer is basically yes, you have to do it the long form way. When
you call myfunction() within the echo statement that's the end of it.
Using the bracketed array notation e.g.: echo myfunction()[0]; is
invalid syntax, as you have seen.
You could always echo inside of the function prior to returning the
object though.
Navigation:
[Reply to this message]
|