Re: echo returnArray()['a']; // workaround

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nathan Nobbe wrote:
On Thu, Feb 28, 2008 at 2:36 PM, Ray Hauge <ray.hauge.lists@xxxxxxxxx>
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


if I show you guys how to do this:

echo sillyFunc()['a'] . PHP_EOL;

using a few brackets and things do you promise not to laugh?
*it's a bit weird*

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux