PHP 7 Dropped

Screen Shot 2015-12-14 at 10.04.32 AM
I missed the news, but on December 3, PHP dropped version 7.

I don’t know what happened to version 6, but version 7 is a major update from PHP 5.6.

PHP 7 comes with a new version of the Zend Engine, numerous improvements and new features such as

  • Improved performance: PHP 7 is up to twice as fast as PHP 5.6
  • Significantly reduced memory usage
  • Abstract Syntax Tree
  • Consistent 64-bit support
  • Improved Exception hierarchy
  • Many fatal errors converted to Exceptions
  • Secure random number generator
  • Removed old and unsupported SAPIs and extensions
  • The null coalescing operator (??)
  • Return and Scalar Type Declarations
  • Anonymous Classes
  • Zero cost asserts

There’s a migration guide for the brave souls who are running to upgrade to this new version. I personally will watch how it all shakes for the next couple of months before delving in.

There’s pretty long list of incompatilities.

Here’s a change that’s going to break a lot of code.

When used in the default by-value mode, foreach will now operate on a
copy of the array being iterated rather than the array itself. This
means that changes to the array made during iteration will not affect
the values that are iterated.

A lot of the backward incompatibility is finally dumping stuff that’s been deprecated for years now.

The result of the new statement can no longer be assigned to a
variable by reference

All of those stupid ASP tags are gone. So you can’t do <%= or <% any more, but you shouldn’t have been doing that anyways.

Previously deprecated in PHP 5.6, static calls made to a non-static
method with an incompatible context will now result in the called
method having an undefined $this variable and a deprecation warning
being issued.

That’s another one that you shouldn’t have been doing. It made no sense before, and now it’s not even possible.

I didn’t even know this was possible, but in PHP 7, you can’t have more than one function parameter with the same name. Why would anyone do that, it’s stupid?

And whoever was doing this next one should be get into therapy quickly, but now you can no longer have more than one default block in a switch statement. Um, why would you want two default blocks? I guess, because you don’t know what default means.

So all you hacks out there that have been “making it work,” you’re going to be having a lot of fun cleaning up all of our shitty code.

Although, it’s unfortunate that the PHP gurus didn’t dump the mysql_* functions. That shit has been deprecated since forever and they need to go. I haven’t used them in well over 10 years, but I just cringe when I see someone posting a question on SO about them. Go away.

Other than that foreach loop working on a copy thing, I don’t see much in the backwards incompatibilities that will trip me up. I’ll wait to see a few minor releases come out before I start thinking about upgrading.

Share Button