Join Kevin Skoglund for an in-depth discussion in this video How to upgrade to PHP 7, part of PHP 7 New Features.
- [Voiceover] In this movie we'll talk about how to upgrade PHP to version seven. Whether you're installing for the first time or upgrading from a previous version of PHP, the process is going to be the same. And the best resource for installing and upgrading is going to be the PHP.net website. If you go to PHP.net/manual/en/install.php then you'll find the latest information about how you go about installing on a number of different platforms, Macintosh, Windows, and Linux.
If you're on a Macintosh, then there's three main ways that you could upgrade. One is that there's an excellent package manager that's maintained by a company called LIIP. They provide a simple installer that'll get everything all set up for you, and if you have an existing installation it'll just replace itself right over the top of that. The second is Homebrew, and if you're comfortable using Homebrew, if you used Homebrew in the past to install PHP, then you can simply upgrade PHP there. And the third is with the package MAMP.
MAMP is an all-in-one package from Macintosh that includes Apache, MySQL and PHP. And if you go to the MAMP download page you'll see that one of the versions that they offer includes PHP 7. If you're upgrading on Windows, then you're probably using the WAMP package. That's the most popular way to install PHP on Windows. WAMP stands for Windows Apache MySQL and PHP, and WAMP also offers a PHP 7 version that you can download. So just look very carefully at the list of versions that it has for each one of the packages to make sure that you get the right one.
Whichever one of these options you choose, they should make upgrading to PHP 7 very easy.
- Scalar type and return type declarations
- New operators in PHP 7
- Anonymous classes
- Arrays as constants
- Catchable exceptions and errors
- Integer division with intdiv()
- Deprecations and deletions