On Sat, 16 Apr 2011 03:42:11 +0200, Adam Richardson <simples...@gmail.com> wrote:

On Fri, Apr 15, 2011 at 8:46 PM, Ben Schmidt
<mail_ben_schm...@yahoo.com.au>wrote:

There was also my suggestion of a "checked ternary" operator [see my
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.


I believe describing nullness checking as a "main" issue is a rather strong
assessment.


I agree. To me, nullness checking is not interesting at all.


$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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to