Hi!
$value = isset($a[$key]) ? $a[$key] : 'Not set';
which is exactly the situation I had before it was introduced.
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.
It is true, however I think the amount of boilerplate code produces by
this paradigm is staggering, and it's about time we fixed that. We had a
chance of doing it with ?: but for one reason or another it was passed,
but the need is still there. I think actually the idea of "expr ??
expr2", meaning (isset($expr)?$expr:$expr2) is not bad. Anybody sees any
holes in it?
And yes, I wouldn't be disappointed too much if ?: didn't generate
notices either. With modern IDEs times when it helped catch typos are
mostly gone, and now these warnings are just a very annoying reason to
write boilerplate code.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php