Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
PHP 5.3 Beta 1 Released (php.net)
3 points by wbond on Jan 29, 2009 | hide | past | favorite | 2 comments


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: