RE: [PHP-DEV] Feature request

From: Date: Mon, 20 Nov 2006 21:05:49 +0000
Subject: RE: [PHP-DEV] Feature request
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-26682@lists.php.net to get a copy of this message
On Thu, November 9, 2006 9:13 pm, Andi Gutmans wrote: >> >>> <?php >> >>> function foo() >> >>> { >> >>> return array(1,2,3,4,5,6); >> >>> } >> >>> >> >>> echo foo()[4]; // <---- it that >> >> It looks a bit perl-ish indeed but I don't see much trouble >> in having that it people really need it... -0.3 :-) The thing is, I see this ending up with people starting to write unintelligible code: echo {$$(foo()[4])}()[17][13]; The 4th element of the return array from foo() is a function name which returns a 2-D array... And, honestly, if you write code like that in the first place, you ought to be shot. :-) Saving a few keystrokes is nifty, but it ends up costing far more in maintenance than its worth in this proposed syntax, imho. 'Course, I don't *have* to use it, so I just won't do that, but I'll end up having to maintain/fix somebody else's mess that DID use it, which is where the -0.3 comes from. If the code is too messed up with this kind of junk, I just won't take the job. I'd rather flip burgers than work on code like this. :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.internals (#26682) next »