stayAmbition.github.io

PHP7新特性

###组合运算符

  • 1 <=> 1; // 0
  • 1 <=> 2; // -1
  • 2 <=> 1; // 1

###NULL合并运算符,告别isset

  • $info = $_GET[‘email’] ?? noemail;
  • $info = isset($_GET[‘email’]) ? $_GET[‘email’] : ‘noemail’;//三目运算符