Re: echo returnArray()['a']; // workaround
| From: | Robert Cummings | Date: | Fri, 29 Feb 2008 05:43:53 +0000 |
| Subject: | Re: echo returnArray()['a']; // workaround | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270712@lists.php.net to get a copy of this message | ||
On Fri, 2008-02-29 at 05:34 +0000, Nathan Rixham wrote:
> Casey wrote:
> >
> > I don't know why I'm continuing this... but for the truly crazy:
> > function w(&$t) {
> > $t = array('f' => '...');
> > return 't';
> > }
> >
> > echo ${w($t)}['f'];
> >
>
> addictive isn't it!
>
> casey, I truelly believe that's as short as it can get - and a great bit
> of code reduction - most impressed :D
>
> concider: w()['f']
I'm sure you meant consider. Concider sounds like fake cider ;)
> the only additions are a ${} wrapper!
Doesn't work that way, he needs the reference in that last one. The last
one is a pseudo solution since it requires the helper reference which
gets littered in the calling scope.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'