PHP: PHP 5.3.0 - Short Ternary Operator

With the Realease of PHP 5.3 have come very much little new details, on of them is the short ternary operator wich annoyed me for a long time because you have to use it with 3 subjects.
Before PHP 5.3.0 this was the only way it could be done:

$result = ($if == 3) ? $than : $else;

Now in PHP 5.3.0 you can write:

$result = ($if == 3) ?: $else;

There is one problem i see here.
I cant use this in my public projects because it will make my code >= PHP 5.3 dependent wich is NOT an Option. But this mixed with the fact that namespaces are now available with PHP 5.3, it will my namespaced code always PHP 5.3 dependent.

Related posts:


Die Kommentarfunktion zu diesem Beitrag wurde deaktiviert.