- Traits has been added. For Example:
//Create traits
trait HttpRequest
{
public function getHttpResponse($url, $port)
{
return $response;
}
}
//Use the traits
class ABC_API
{
use HttpRequest; // use our trait
public function getResponse($url)
{
return $this->getHttpResponse($url, 80);
}
}
- Short array syntax has been added. For Example:
$array = [1,2,3,'Web technology','Experts Notes'];
- Function array dereferencing has been added. For Example:
function fruits(){
return array(0=>'Apple', 1=>'Banana', 2=>'Mango',3=>'Orange');
}
echo fruits()[2]; //Mango
- Closures now support $this.
- Class member can access on instantiation has been added. For Example:
class test{
function fruits(){
return array(0=>'Apple', 1=>'Banana', 2=>'Mango',3=>'Orange');
}
}
print_r((new test())->fruits());
Output:
Array
(
[0] => Apple
[1] => Banana
[2] => Mango
[3] => Orange
)
- Class::{expr}() syntax is now supported. For Example:
class test{
static function newMethod(){
echo "called function";
}
}
$method = 'newMethod';
// this works
test::$method();
// and this works
test::{'newMethod'}();
- Binary number format has been added, e.g. 0b001001101.
- Improved parse error messages and improved incompatible arguments warnings.
- The session extension can now track the upload progress of files.
- Built-in development web server in CLI mode.