Re: Implicit isset/isempty check on short-ternary operator

From: Date: Sat, 23 Apr 2011 11:21:38 +0000
Subject: Re: Implicit isset/isempty check on short-ternary operator
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-51992@lists.php.net to get a copy of this message
I was planning on replying to the "coalesce" suggestion but you really took my concerns and stated them much better than I could have myself, plus a couple of other concerns I didn't even think about. To respond to Arpad Ray's statement: "To elaborate, I'd probably think this code was an unlikely series of typos, or an encoding error:" In my opinion that's a good thing. Then you might actually look it up in the documentation instead of making the assumption that the syntax has function-like properties just because it looks like a function. For example, it took me at least 1 year from first encountering empty() until understanding that it's not a normal function and actually a language construct that suppresses unset notices. And I'm a pretty seasoned programmer. There's only one thing worse than magic: hidden magic. ~Hannes On 23 April 2011 05:05, Ben Schmidt <mail_ben_schmidt@yahoo.com.au> wrote: > It's good for some situations, but there are plenty more where it doesn't > cut it, e.g. $_GET[?'foo'] $:= get_default_from_db('foo') $: > "hard-coded". > > Ben. > >

« previous php.internals (#51992) next »