PHP 5.6.0. Released
PHP 5.6.0., considered a very important cornerstone by many, has been released today. We’ve talked about the changes this version brings in previous posts, and others have written about it, too.
To recap quickly:
- MIME types in the CLI web server have been added
- Internal Operator Overloading
- Uploads of over 2GB are now accepted
- POST data memory usage decreased and
- Improved syntax for variadic functions, functions that can accept an arbitrary number of arguments
- Argument unpacking
- Constant Scalar Expressions
- PHPDBG bundled by default
- Zip improved
- Importing namespaced functions and constants
- Exponentiation (
$a = 2**3;)
- Default UTF-8
- GMP operator overloading
Regarding BC breaks, some of them include:
- GMP resources are now objects, which will break previous usages of is_resource
- mcrypt requires valid keys and IVs
- json_decode is more strict about upper/lower case on “true”, “false” and “null”
You can go into detail by reading the previous posts we wrote on these topics, or by reading the migration guide: http://docs.php.net/manual/en/migration56.new-features.php
You might be wondering about update procedures – do you have to add new repos to your OS or compile from source to get them to work? What about VMs? Well, you can do that (see our old post on getting RC1 to run on Homestead, or coderabbi’s post about upgrading the current Homestead box to 5.6), but you don’t have to. Taylor Otwell has already promised to update the original Homestead box with 5.6, so you can continue to use our Homestead Improved as you always did – up and running in five minutes tops.
@bitfalls i will be upgrading it so people can just do “vagrant box update”
— Taylor Otwell (@taylorotwell) August 22, 2014
Like the man says, all you’ll need to do is run
vagrant box update and your box will be refreshed with the latest version. This applies both to the original Homestead and my own Homestead Improved. It might take a while for Vagrant to redownload the box, but once done, everything should be as easy as it ever was.
Note: The box has since been updated, enjoy!
If you’d like to keep track of the original box to see when it updates, see here.
So what’s next? While the internals group is working on PHPNG and PHP7, whatever those may end up being called, take the time to get familiar with PHP 5.6. If you use shared hosting, ask them to upgrade. If they don’t have plans to do so, ditch them and show them you don’t support outdatedness. Get a cheap virtual server at DigitalOcean – heck, using this link will even get you $10 which lets you host a level two server for a whole month, or a level one server for two months. That’s plenty of time to see what they offer.
Use Heroku’s free tier to get 5.6 up and running, play around with it, explore. Step ahead of the curve by diving head first into the cutting edge and don’t let yourself be left behind by those ready to take the plunge. We’re stable, this is no longer beta or RC mode – it’s safe to upgrade, and it’ll only benefit your applications in the long run. If you’ve got some legacy code to maintain, ditch that too if it’s not compatible with 5.6.
Have you experimented with 5.6 features in a real world use case yet? Let us know in the comments below! Better yet – if you can put together advanced demos of these features, we’ll pay you for the right to publish them. Go forth, and multiply your projects!