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());
Maybe it will be faster if you use the temp (ugly) variable than call a method :]

The only optimizations I'm concerned with in this example are aesthetics and my own sanity. It just looks so ugly to use a temp variable.
In my opinion it is more clear what exactly is going on if you use a variable.


I suppose you're right about it being clear, but to me it lacks aesthetic value that might make it more fun. I'm thinking of Ruby or JQuery right now, with their ability to string together objects.

Incidentally, PHP does allow me to access properties of an object returned from a function:
echo abc()->foo;


_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to