New Feature PHP 7

New Feature PHP 7

New feature php7 - 1:
* Spaceship Operator:
- Spaceship Operator can be used in sorting and combined comparisons.
It works like strcmp() and version_compare().
- Example:
- before php7
($a < $b) ? -1 : (($a > $b) ? 1 : 0);
- after php7
$a <=> $b;

* Create constant Array using define:
- define('Cars', [ 'BMW', 'Audi', 'Volvo' ]);
- In PHP5.X, you can only define array with const.

* intdiv() function:
- it perform integer division of operands.
Example:
$div = intdiv(5,2);
- it retuend 2;

* Null Coalesce Operator:
- This operator returns the first operand if exists or returns 'nobody'.
Example:
$username = $_GET['user'] ?? 'guest';

* Closure::call() :
- This is the new method added into core. It allows variable binding at call time rather pre-binding.