5 New Features in PHP 7
1. SPEED!
Benchmarks for PHP 7 consistently show speeds twice as fast as PHP 5.6 and many times even faster!
2. Type Declarations
(1)
function enroll(Student classes) {
foreach (class) {
echo "Enrolling " . class;
}
}
(2)
function getTotal(float b) : int {
return $a + $b;
}
3. Error Handling
New Hierarchy,Throwable Interface,Type Errors,Type Errors
4. New Operators
(1) Spaceship Operator <=>
$compare = 2 <=> 1
2 < 1 ? return -1
2 = 1 ? return 0
2 > 1 ? return 1
(2) Null Coalesce Operator ??
firstName ?? placeholder ?? “Guest”;
The important thing is that it will not raise a notice if the left operand is a non-existent variable.
5. Easy User-land CSPRNG
**What is Easy User-land CSPRNG? **
User-land refers to an application space that is external to the kernel and is protected by privilege separation, API for an easy to use and reliable Cryptographically Secure PseudoRandom Number Generator in PHP.
Get Involved
It’s an exciting time to be involved with PHP! Not only for the language itself, but also the community. If you haven’t jumped on board with the PHP community yet, I’d encourage you to start today.
Find your local users group: http://php.ug
WordPress http://wordpress.meetup.com/
Drupal https://groups.drupal.org/
NomadPHP http://nomadphp.com