Do we really need that as operator? Why not using new functions for
special cases.
Don't see much difference between

$a = $b ?: $c;

and (for example I used "i" for "if")

$a = _i($b, $c);

Just a manner of getting accustomed to it.

A little bit more thinking: This could be implemented directly into
any program/project, so it is a manner of how to use PHP and not of
why it isn't added to the language.

PS: Would it be possible to implement functions like ":?()" or "!?()"
? Currently this is not allowed by syntax.


2012/7/18 Rafael Dohms <lis...@rafaeldohms.com.br>:
> $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?

-- 
Alex Aulbach

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

Reply via email to