### New Constant options

``````<?php
/*
* A few additon of how you can work using constants
*/
const ONE = 1;         // Regular constant
const TWO = ONE * 2;    // New feature
const ARR = ['a', 'b']; // Possible to define Array Constants

class C {
// As properties
const THREE = TWO + 1;
const ONE_THIRD = ONE / self::THREE;
onst SENTENCE = 'The value of THREE is '.self::THREE;

// As default function arguments
public function f(\$a = ONE + self::THREE) {
return \$a;
}
}

echo (new C)->f(); // Outputs: 4
echo C::SENTENCE;  // Outputs: The value of THREE is 3``````

### Variadic functions via "..." operator

``````<?php
/*
* This a new way to create functions with a variable number of arguments.
*/
function sum(...\$numbers) {
\$acc = 0;
foreach (\$numbers as \$n) {
\$acc += \$n;
}
return \$acc;
}
echo sum(1, 2, 3, 4); // Outputs: 10

// ---------------------------------------------------------------

function f(\$req, \$opt = null, ...\$params) {
// \$params is an array containing the remaining arguments.
echo count(\$params);
}

f(1);             // outputs: 0
f(1, 2);          // outputs: 0
f(1, 2, 3);       // outputs: 1
f(1, 2, 3, 4);    // outputs: 2
f(1, 2, 3, 4, 5); // outputs: 3``````

### Argument unpacking via "..." operator

``````<?php
/*
* Arrays and Traversable objects can be unpacked into argument
* lists when calling functions by using the ... operator.
* This is called splat operator in other languages.
*/
return \$a + \$b + \$c;
}

\$operators = [2, 3];

### Exponentiation via **

``````<?php
/*
* A right associative ** operator has been added to support exponentiation,
* along with a **= shorthand assignment operator.
*/
echo 2 ** 3; // outputs 8

\$a = 2;
\$a **= 3; // \$a value is 8``````

### 'use function' and 'use const'

``````<?php
/*
* The use operator has been extended to support importing functions
* and constants in addition to classes.
*/
namespace Name\Space {
const FOO = 42;
function f() { return 0 }
}

namespace {
use const Name\Space\FOO;
use function Name\Space\f;

// .. Use FOO and f();
}``````

For a full list of changes go here.

Hire me!

I'm currently open for new projects or join pretty much any project i may fit in, let me know!