Hey Everyone,

With the syntax improvements for 5.4 and some of the de-referencing work,
code looks so much sleeker then before, but there is still one use case
that really bugs me.

Given this code:

$width = (isset($config['width']))? $config['width'] : 300;

The code is pretty straight forward, if width is set in the array, use it
otherwise use 300.

This code would look much better if it could make use of the ternary
operator

$width = $config['width'] ?: 300;

The only reason for this to not work is: it throws a notice if the array
key is not there (which is the case we are covering anyway)

This is basically because the ternary operator does not do a internal
implicit isset, only an empty.

Does this seem like a possible improvement we can work on? Anyone
interested in championing the change?

-- 
Rafael Dohms
PHP Evangelist and Community Leader
http://www.rafaeldohms.com.br
http://www.phpsp.org.br

Reply via email to