23K Views

New Features In PHP 7

The features of PHP7 are fairly enough for advance web application development and making use of latest resources to boost you development.

PHP 7 was released in December 2015. The main reason behind the PHP7 is PHP6 has never reached to stable version, So PHP community has chosen PHP5.6 to directly PHP7.

 

                                             Necessity To Upgrade:

 

Features:

Group use declaration:

 

Return type declaration:

Return type declaration specifies that the type of value that a function should return.

 

Scalar type hints:

Type hints have been available in PHP for while now. Unfortunately they were restricted to classes, arrays and callables.
As of PHP 7, the scalar types (integers, floating point numbers, Booleans and strings) can also be used as type hints.

 

Level support for dirname() function:

In PHP 4 and higher:
return dirname ( dirname (_file_));

In PHP 7:
return dirname (_file_ , 2);

 

The null coalesce operator:

We have used Ternary operator in PHP 5.

Now php7 provided null coalescing operator (??) to accomplish it easy way.

Coalescing can be chained:

 

Spaceship operator (<=>)

Spaceship operator return only -1, 0 or 1 by performed to compare two values.

$a > $b then it will return 1.
$a < $b then it will return -1.
$a = $b then it will return 0.

 

Generator delegation:

O/P : 1 2 3 4

 

I’ve explored this while contributing to Symfony based project UVdesk, there are a lot more things to learn and you could also contribute to an enterprise-level open source helpdesk.

Thanks for reading me. Hope it will help someone to use new features of PHP7.

 

UVdesk Forum!          Developer Visit!             Contact Us!         Live Demo!

 

Category(s) PHP7 Symfony UVdesk
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php