2 comments

[ 2.9 ms ] story [ 19.7 ms ] thread
The first beta released of PHP 5.3 was packaged today. It includes new features such as late static binding, closures (minus OOP closure support), namespaces, the ?: operator, and __callStatic().
For others that were wondering what the ?: operator is I found this after a bit of googling:

?: 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".