[UPHPU] Accessing an element in an array returned from a function
Isaac
keogh24 at gmail.com
Thu Jan 29 17:44:55 MST 2009
On Thu, Jan 29, 2009 at 2:55 PM, Richard K Miller
<richardkmiller at gmail.com>wrote:
> If abc() returns an array, is there any possible notation that lets me
>>> access a single element?
>>> echo abc()[0]; // I wish this were possible
>>> ...instead of having to use an intermediate variable?
>>> $temp = abc(); // $temp is ugly
>>> echo $temp[0];
>>>
>>
>> echo current(abc());
>>
>
> Thanks, Ray. What about an arbitrary element, such as $temp[7] or
> $temp['foo']?
>
> I'm surprised to not see anything like this, despite there being current(),
> list(), range(), etc.
>
>
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>
Maybe it will be faster if you use the temp (ugly) variable than call a
method :]
Regards
More information about the UPHPU
mailing list