PHP gets its own formal language specification

PHP scripting language, a critical cog in Web development, codifies its semantics and syntax to minimize divergence

Although the PHP scripting language has been around since 1995 and is a staple of Web development, it does not actually have a formal language specification -- just extensive user documentation. But that is all set to change.

Led by Facebook, a draft specification has been posted on GitHub to provide a complete definition of PHP language semantics and syntax.

"The next major version of PHP -- PHP7 -- is in the works, and in order to ensure full compliance with existing PHP scripts it's important to know what is expected from the engine," said Facebook's Sara Golemon, who participated in the development of the specification. "Additionally, with alternative implementations like HHVM coming on the scene, it's important to keep divergence to a minimum, again by understanding what a well-behaved engine looks like."

The PHP Group, which includes PHP founder Rasmus Lerdorf as well as Andi Gutmans, CEO of tools vendor Zend Technologies, is overseeing the specification. The group also conducts the website, the principal site for PHP's development. Making changes to the specification will require a account.

Facebook's HHVM, formerly known as HipHop Virtual Machine, was built with the intention of making PHP run fast. The planned specification will make sure HVVM is a fully compatible implementation for PHP, Golemon said. "For example, the conformance suite we released along with the spec shows HHVM failing a number of edge cases.  By having that signal, we can bring HHVM more in line with PHP."

Next up for the specification are improving wording, correcting edge cases, and boosting the conformance suite. "In the long term, this document will be developed alongside the PHP implementation to document new syntax in a formal manner, such as the recent addition of the pow operator, variadics, and splat," Golemon said.

Developers involved with the language have been working on improvements to boost real-world application performance. In the lab, these changes have resulted in decreased memory usage as fewer machine instructions are necessary to execute an application.

This story, "PHP gets its own formal language specification," was originally published at Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow on Twitter.


Copyright © 2014 IDG Communications, Inc.