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

2008-05-24 Thread Nitsan Bin-Nun
Nice trick, I will remember this one. Thanks for sharing, Nitsan On 23/05/2008, Nathan Nobbe [EMAIL PROTECTED] wrote: On Fri, Feb 29, 2008 at 12:16 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: wow, im going to have to stare at some of those and play around with them as soon as im half awake

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

2008-05-22 Thread Nathan Nobbe
On Fri, Feb 29, 2008 at 12:16 AM, Nathan Nobbe [EMAIL PROTECTED] wrote: wow, im going to have to stare at some of those and play around with them as soon as im half awake :) of course i still like my solution ;) but im excited about the experimentation and ideas that have been shared on

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

2008-02-29 Thread Shawn McKenzie
Nathan Rixham wrote: Nathan Nobbe wrote: On Thu, Feb 28, 2008 at 6:14 PM, Nathan Rixham [EMAIL PROTECTED] wrote: 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* id like to see it.

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

2008-02-28 Thread Ray Hauge
Nathan Nobbe wrote: all, as we have discussed previously, php does not have support for retrieving array values on the same line in which they are returned. i have created a simple workaround, and would like to share. first there is the class (w/ other features omitted for the post) ?php

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

2008-02-28 Thread Nathan Nobbe
On Thu, Feb 28, 2008 at 2:36 PM, Ray Hauge [EMAIL PROTECTED] 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

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

2008-02-28 Thread Eric Butera
On Thu, Feb 28, 2008 at 2:16 PM, Nathan Nobbe [EMAIL PROTECTED] wrote: all, as we have discussed previously, php does not have support for retrieving array values on the same line in which they are returned. i have created a simple workaround, and would like to share. first there is the

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

2008-02-28 Thread Jim Lucas
Nathan Nobbe wrote: all, as we have discussed previously, php does not have support for retrieving array values on the same line in which they are returned. i have created a simple workaround, and would like to share. first there is the class (w/ other features omitted for the post) ?php

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

2008-02-28 Thread Nathan Rixham
Nathan Nobbe wrote: On Thu, Feb 28, 2008 at 2:36 PM, Ray Hauge [EMAIL PROTECTED] 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

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

2008-02-28 Thread Nathan Nobbe
On Thu, Feb 28, 2008 at 4:22 PM, Jim Lucas [EMAIL PROTECTED] wrote: So, I guess my question would be, why not take it one level deeper. ?php include('ArrayClass.php'); function sillyFunc() { return ArrayClass::create(array('a' = 1, 'b' = 2, 'c' = 3, 'd' = 4)); } echo sillyFunc()-a

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

2008-02-28 Thread Nathan Nobbe
On Thu, Feb 28, 2008 at 6:14 PM, Nathan Rixham [EMAIL PROTECTED] wrote: 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* id like to see it. -nathan

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

2008-02-28 Thread Nathan Rixham
Nathan Nobbe wrote: On Thu, Feb 28, 2008 at 6:14 PM, Nathan Rixham [EMAIL PROTECTED] wrote: 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* id like to see it. -nathan don't say I didn't

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

2008-02-28 Thread Robert Cummings
On Fri, 2008-02-29 at 00:18 +, Nathan Rixham wrote: don't say I didn't warn ya fellow nathan! #!/usr/bin/php ?php function sillyFunc() { return array('a' = 1, 'b' = 2, 'c' = 3, 'd' = 4, 'e'='some string'); } echo !${~${''}='sillyFunc'}=${''}().${~${''}}['e'] . PHP_EOL; I

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

2008-02-28 Thread Nathan Rixham
Robert Cummings wrote: On Fri, 2008-02-29 at 00:18 +, Nathan Rixham wrote: don't say I didn't warn ya fellow nathan! #!/usr/bin/php ?php function sillyFunc() { return array('a' = 1, 'b' = 2, 'c' = 3, 'd' = 4, 'e'='some string'); } echo

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

2008-02-28 Thread Nathan Rixham
Robert Cummings wrote: On Fri, 2008-02-29 at 00:18 +, Nathan Rixham wrote: don't say I didn't warn ya fellow nathan! #!/usr/bin/php ?php function sillyFunc() { return array('a' = 1, 'b' = 2, 'c' = 3, 'd' = 4, 'e'='some string'); } echo

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

2008-02-28 Thread Robert Cummings
On Fri, 2008-02-29 at 04:04 +, Nathan Rixham wrote: Robert Cummings wrote: On Fri, 2008-02-29 at 00:18 +, Nathan Rixham wrote: don't say I didn't warn ya fellow nathan! #!/usr/bin/php ?php function sillyFunc() { return array('a' = 1, 'b' = 2, 'c' = 3, 'd' = 4, 'e'='some

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

2008-02-28 Thread Robert Cummings
On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote: On Fri, 2008-02-29 at 04:04 +, Nathan Rixham wrote: Robert Cummings wrote: On Fri, 2008-02-29 at 00:18 +, Nathan Rixham wrote: don't say I didn't warn ya fellow nathan! #!/usr/bin/php ?php function sillyFunc()

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

2008-02-28 Thread Nathan Rixham
Robert Cummings wrote: On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote: On Fri, 2008-02-29 at 04:04 +, Nathan Rixham wrote: Robert Cummings wrote: On Fri, 2008-02-29 at 00:18 +, Nathan Rixham wrote: don't say I didn't warn ya fellow nathan! #!/usr/bin/php ?php function

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

2008-02-28 Thread Robert Cummings
On Fri, 2008-02-29 at 04:38 +, Nathan Rixham wrote: Robert Cummings wrote: On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote: On Fri, 2008-02-29 at 04:04 +, Nathan Rixham wrote: Robert Cummings wrote: On Fri, 2008-02-29 at 00:18 +, Nathan Rixham wrote: don't say I

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

2008-02-28 Thread Casey
On Thu, Feb 28, 2008 at 8:38 PM, Nathan Rixham [EMAIL PROTECTED] wrote: Robert Cummings wrote: On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote: On Fri, 2008-02-29 at 04:04 +, Nathan Rixham wrote: Robert Cummings wrote: On Fri, 2008-02-29 at 00:18 +, Nathan Rixham

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

2008-02-28 Thread Robert Cummings
On Thu, 2008-02-28 at 20:42 -0800, Casey wrote: On Thu, Feb 28, 2008 at 8:38 PM, Nathan Rixham [EMAIL PROTECTED] wrote: Robert Cummings wrote: On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote: On Fri, 2008-02-29 at 04:04 +, Nathan Rixham wrote: Robert Cummings wrote:

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

2008-02-28 Thread Casey
On Thu, Feb 28, 2008 at 8:42 PM, Casey [EMAIL PROTECTED] wrote: On Thu, Feb 28, 2008 at 8:38 PM, Nathan Rixham [EMAIL PROTECTED] wrote: Robert Cummings wrote: On Thu, 2008-02-28 at 23:27 -0500, Robert Cummings wrote: On Fri, 2008-02-29 at 04:04 +, Nathan Rixham wrote:

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

2008-02-28 Thread Nathan Rixham
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

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

2008-02-28 Thread Robert Cummings
On Fri, 2008-02-29 at 05:34 +, 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!

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

2008-02-28 Thread Nathan Nobbe
wow, im going to have to stare at some of those and play around with them as soon as im half awake :) of course i still like my solution ;) but im excited about the experimentation and ideas that have been shared on this topic, very interesting really! -nathan