Re: echo returnArray()['a']; // workaround
| From: | Nathan Nobbe | Date: | Thu, 28 Feb 2008 19:41:21 +0000 |
| Subject: | Re: echo returnArray()['a']; // workaround | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270641@lists.php.net to get a copy of this message | ||
On Thu, Feb 28, 2008 at 2:36 PM, Ray Hauge <ray.hauge.lists@gmail.com>
wrote:
> That's pretty cool. I wasn't sure if it would work with numerically
> indexed arrays, so I tried:
>
> // sillyFunc returns array(0=>1, 1=>2);
>
> ArrayClass::create(sillyFunc())->{"0"}
>
> I just tested it, and that works. If you leave off the curly braces and
> quotes, then you obviously get a parse error. The curly braces are
> necessary.
cool, thanks for the tip :)
-nathan