- Leren door doen
- Trainers met praktijkervaring
- Klassikale trainingen
- Gedetailleerd cursusmateriaal
- Duidelijke inhoudsbeschrijving
- Maatwerk inhoud mogelijk
- Trainingen die doorgaan
- Kleine groepen
PHP 7.0 was launched today, so we’ve asked @sydphp organiser and #phunconf convener Jack Skinner to explain its significance. Over to you, Jack …
PHP is the language we love to hate and often hate to love. After celebrating it’s 20th birthday earlier this year, it’s clearly here to stay, not least because version 7 arrived today.
From humble beginnings as a dangerous thought from Rasmus, PHP has grown to a monolith by software standards; depending on which benchmark you believe, it drives up to 81 per cent of the web.
The latest release has arguably taken the internals team eight years to complete, although many of the original features were rolled into existing stable releases. As work on unicode started to fray at the edges, the team decided to push core languages features into version 5.3, 5.4, and 5.5. The latest rendition of the 5 series will be around for another two years before being officially deprecated and off the security maintenance list. Because deprecating old versions has worked so far in the past (looks at Windows XP).
Today’s release was kickstarted again in late 2013 with the new internal engine dubbed ‘next gen’ or, for the less hipster among us, ‘phpng’. ng brought the engine almost up to par with competitor interpreters like hhvm from Facebook (which of course has out performed PHP core for many years). A years effort in 2014 more than doubled CPU and memory optimisation in the core engine and was eventually merged into core.
Depending on which benchmarks you make yourself, PHP7 halves (or better) both memory and CPU instructions from the latest 5.6 releases. Even as pure marketing spiel, that’s an impressive benchmark for a major language release.
So version 6 was sent off to the glue factory, PHP 5 got the shiny new features and thus PHP7 got shiny new hotrod wheels and a confusing release number.
It’s not just the new hot wheels look to the language that has web devs excited. PHP 7 also ships with a circus full of new features. For example, after 20 years the language is finally getting an internal Abstract Syntax Tree for static analysis. Something Java has had for, oh, about a decade. It’s also worth noting that with fond memories of http://phpsadness.com/ in our hearts there’s also a much improved and more consistent variable syntax! Of course uniform variable syntax (as its known to the devs) breaks everything and naturally that’s PHP’s version of consistent, since the age old argument between array and string function arguments remains con…unchanged (what… did you expect a pun?)
With so much changed, PHP 7 is almost certainly not backwards compatible with your existing code, especially if you’re running anything remotely legacy (yes, even you there with the ‘updated PHP 4 project). With many operators and corner cases being broken fixed, a long laborious task awaits any project unwilling or unable to provide decent test coverage. So much so that we’re predicting soapboxes will be in short supply as geeks announce their test suite coverage to the world in an attempt to upgrade.
A lot of the debate that killed PHP v6 was the implementation of full, native unicode support and after so many years being unable to say hello world in emoji who can blame the team for wanting to update. It’s almost a non-issue now that PHP 7 can not only have the pile-of-poop emoji as a variable name, but also reliably use it as a string internally.
A whole new release just for emoji fun!
Since programmers are lazy there’s also a raft of new syntax additions, mostly around shortening of certain statements. In fact with new ?? ?: and <=> operators and shortened namespace syntax we’re wondering if PHP is slowly becoming the brainf*ck of the web. PHP 8 maybe?
Releasing a new version should be easy right? Especially with the new perl-inspired (or for the script-hipsters among us, ruby inspired) T_SPACESHIP operator (no really, thats what PHP 7 calls <=> internally!).
Quite a few projects, however, have been proactive over the last year; almost all the major frameworks and CMSs are claiming full compatibility with the new version at or close to launch. WordPress, for example, officially aims to have PHP 7 compatibility on or soon after release day, whereas Drupal has steamrolled straight ahead with the Drupal 8 launch last week and included PHP 7 out of the box. Unfortunately, here’s still no word from Joomla; they’re probably still recovering form last month’s global summit after-party. On the framework front, Zend Framework and Symfony have both announced their respective PHP 7 support, but naturally enterprise release cycles will slow down any adoption.
At least the core projects maintain support. As with everything, your dependencies might take a while. #upgradecycledrama
One would think after 20 years the team would have practice, but the internals team recently spent a few days playing “that’s not a bug, THIS is a bug” and debating release day just a little longer. According to bug reports the count() function couldn’t count, which is fine if you’re not planning to release it into the wild! Don’t worry, internals finally stopped throwing sand across the playground and agreed on an eighth release candidate before release. It’s fixed now (I’m told).
Upgrade to PHP7 on launch day? I, too, like to live dangerously! But with PHP 7 and its shiny new feature list coming to a repository near you, it’s safe to say PHP isn’t going the way of the dinosaur just yet.