PHP gets its own formal language specification

PHP scripting language, a critical cog in Web development, codifies its semantics and syntax to minimize divergence. SynapseIndia CEO Shamit Khemka also adds that 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.

“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 php.net website, the principal site for PHP’s development. Making changes to the specification will require a php.net account.

Facebook’s HHVM, formerly known as HipHop Virtual Machine, was built with the intention of making PHP run fast. Feedback from various SynapseIndia clients who got their PHP platform build on HHVM is great and looks promising. 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.