Re: Implicit isset/isempty check on short-ternary operator
| From: | Rasmus Lerdorf | Date: | Thu, 07 Apr 2011 22:03:48 +0000 |
| Subject: | Re: Implicit isset/isempty check on short-ternary operator | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51828@lists.php.net to get a copy of this message | ||
On 4/7/11 5:59 PM, Matthew Weier O'Phinney wrote:
It may change the semantics as they stand, but I'd argue that the _expectation_ from the shorthand ternary is to shorten code that currently uses isset(). As it is, I have almost no use for it at this point, as I end up needing to do:Not sure why you would have that expectation. The long ternary doesn't do that, and there is nothing about the short ternary that changes that. There was talk of a new ifsetor type of operator to have those semantics but never any talk of changing existing semantics. -Rasmus$value = isset($a[$key]) ? $a[$key] : 'Not set';which is exactly the situation I had before it was introduced.