by shaunxcode · 17y ago · 0 comments
?: Operator Allows quick retrieval of a non-empty value from 2 values and/or expressions
$a = true ?: false; // true
$a = false ?: true; // true
$a = 0 ?: 2; // 2
$a = array() ?: array(1); // array(1);
After reflecting on this mutation of the ternary operator I am thinking that the use of something more like !? or ?! or even just ! would make more semantic sense. ?: implies "if this, then that" and what it is doing is "if NOT this then that".No comments yet.