Re: Implicit isset/isempty check on short-ternary operator
| From: | Ole Markus With | Date: | Sat, 16 Apr 2011 10:01:07 +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-51915@lists.php.net to get a copy of this message | ||
On Sat, 16 Apr 2011 03:42:11 +0200, Adam Richardson <simpleshot@gmail.com> wrote:
On Fri, Apr 15, 2011 at 8:46 PM, Ben Schmidt <mail_ben_schmidt@yahoo.com.au>wrote:I agree. To me, nullness checking is not interesting at all.There was also my suggestion of a "checked ternary" operator [see myI believe describing nullness checking as a "main" issue is a rather strong assessment.previous email in this thread.] Backwards compatible, practical, and simple.It doesn't address the main issues of code duplication and nullness checking, IMHO, so isn't a contender. Even though it's simple and compatible, it is only practical in a handful of cases.
$var = $arr['key'] ?? : 'empty'; is a significant improvement over the current means and does in fact remove redundant code.If I understood it correctly, this is the essense of what I want. Compared to the original description of checked ternary I strongly object to this working on non-arrays. But given that constraint, my vote goes to the checked ternary operator as well. -- Ole Markus With