Feeds

What's that? A PHP SPECIFICATION? Surely you're joking, Facebook

Zuck's engineers unveil formal spec based on PHP 5.6

Providing a secure and efficient Helpdesk

A group of Facebook developers has decided to break with 20 years of tradition and release a formal specification for the PHP programming language.

The initial draft of the spec was released on Wednesday and is available via a Git repository hosted on PHP.net.

Language specs, in and of themselves, are nothing new. Many of the most popular programming languages today have thorough, public specifications available, including C++, C#, Java, JavaScript, and more. Even some proprietary languages, like Visual Basic, offer public specs.

But although it has been around since 1994 and has become one of the more ubiquitous languages for server-side web programming, nobody has ever bothered to write a formal specification for PHP – until now, that is.

Previously, if you wanted to understand how the PHP language worked, you looked at the behavior of the reference PHP interpreter, known as the Zend Engine. If the Zend Engine behaved a certain way, then that was the way the PHP language was supposed to behave.

While that was all well and good when there was just one implementation of PHP, however, it became a problem once other implementations started to emerge, some of which were designed dramatically differently than the Zend Engine.

Enter Facebook. Huge amounts of Facebook's code have always been written in PHP, but as the social network began to scale to its current monster size, there was no way it could wring the performance it needed out of the stock Zend Engine.

To address that problem, Facebook engineers developed two alternative PHP implementations. The first, called HipHop, translated PHP code into C++, which it then compiled into blazing-fast native machine code.

More recently, Facebook has replaced HipHop with a new engine called the HipHop Virtual Machine (HHVM), a just-in-time (JIT) compiler that claims to execute code up to six times faster than the Zend Engine.

But as Facebook's back-end code has evolved, so has PHP. The release of PHP 5.6 is imminent, and if the next version of HHVM is to match its behavior exactly, Facebook needs to know exactly how it's supposed to work.

That's why a group of Facebook developers announced at the recent OSCON conference in Portland, Oregon that they planned to do what had never been done before: draft a formal spec based on the expected behavior of PHP 5.6.

Note that this specification doesn't aim to fix any of PHP's quirks and problems. In announcing the draft, Facebook's Joel Marcey described PHP as "one of the most popular programming languages in the world," but here at Vulture Annex we prefer the term "widely used" to "popular," since PHP certainly has plenty of detractors. [I wouldn't touch it with a ten-foot pole. – Ed.]

Most critically, the spec only covers the PHP language itself. It doesn't cover the runtime library at all, so it doesn't help to explain PHP's inconsistent function naming, its redundant and chaotic database access functions, its unpredictable arrangement of function arguments and return values, and other such head-scratchers.

What it does provide, however, is a first step toward allowing the broader PHP community to have a more rigorous and sane understanding of the language's design [where there is any. – Ed.] and how it's meant to work.

As Facebook's Sara Golemon said when announcing the project, "This document is meant for PHP, and PHP should be the steward of it going forward, so we ... should start looking at good ways to keep it up to date and revise it over time." ®

Internet Security Threat Report 2014

More from The Register

next story
Google+ goes TITSUP. But WHO knew? How long? Anyone ... Hello ...
Wobbly Gmail, Contacts, Calendar on the other hand ...
UNIX greybeards threaten Debian fork over systemd plan
'Veteran Unix Admins' fear desktop emphasis is betraying open source
Preview redux: Microsoft ships new Windows 10 build with 7,000 changes
Latest bleeding-edge bits borrow Action Center from Windows Phone
Microsoft promises Windows 10 will mean two-factor auth for all
Sneak peek at security features Redmond's baking into new OS
Netscape Navigator - the browser that started it all - turns 20
It was 20 years ago today, Marc Andreeesen taught the band to play
DEATH by PowerPoint: Microsoft warns of 0-day attack hidden in slides
Might put out patch in update, might chuck it out sooner
Redmond top man Satya Nadella: 'Microsoft LOVES Linux'
Open-source 'love' fairly runneth over at cloud event
prev story

Whitepapers

Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
Why and how to choose the right cloud vendor
The benefits of cloud-based storage in your processes. Eliminate onsite, disk-based backup and archiving in favor of cloud-based data protection.
Three 1TB solid state scorchers up for grabs
Big SSDs can be expensive but think big and think free because you could be the lucky winner of one of three 1TB Samsung SSD 840 EVO drives that we’re giving away worth over £300 apiece.
Reg Reader Research: SaaS based Email and Office Productivity Tools
Read this Reg reader report which provides advice and guidance for SMBs towards the use of SaaS based email and Office productivity tools.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.