Programming language PHP 8 is out: This new JIT compiler points to better performance

A senior Google database expert loves the JIT compiler, but others doubt its worth and say it could be hard to maintain.
Written by Liam Tung, Contributing Writer

The team behind scripting language PHP has announced PHP version 8.0, a major release that may require developers to review code for any breaking changes.  

This version of 25-year old PHP introduces an improved type system, a new JIT compiler in the PHP engine and some features borrowed from Python and JavaScript, such as named arguments and null safe operators. 

PHP isn't particularly liked as a language but it is widely used among web developers. Developers rank PHP as the sixth 'most dreaded' language in Stack Overflow's 2020 developer survey, but it also emerges as the eighth most commonly used language.   

SEE: Meet the hackers who earn millions for saving the web, one bug at a time (cover story PDF) (TechRepublic)

Developer analyst RedMonk currently positions PHP as the fourth most popular language, only behind Java, Python and JavaScript. Tiobe Software puts PHP in eighth place. And, according to job search engine Indeed, job postings for entry-level PHP developer roles have increased over 800% in the past year.   

PHP is maintained by the PHP core development team and Zend, a US-based PHP-focused development consultancy co-founded by Andi Gutmans, general manager and vice president of databases engineering at Google. Gutmans said he's "excited" about the just-in-time (JIT) compiler

The JIT compiler is meant to bring performance improvements to web applications. However, Brent Roose, a Belgian developer behind stitcher.io, said it doesn't necessarily deliver when it comes to web requests. 

As an interpreted language – like JavaScript and Python – PHP code is translated at runtime. It's not a compiled language like C, Java or Rust, and needs to be translated for the CPU to understand PHP code. 

"A JIT compiler may improve the performance of your program significantly, but it's a difficult thing to get right," noted Roose

The pros of having a JIT compiler is that it could make PHP a better language for use outside the web, but it could make it more difficult to debug code in the compiler. Roose noted that if there is a bug, users of PHP will depend on the maintainers of the JIT compiler, which could mean slower security patches and bug fixes. 

"With just a few people being able to maintain [the PHP] code base today, the question whether the JIT compiler can be maintained properly seems justified. Of course, people can learn how the compiler works. But it is complex material nevertheless," said Roose. 

He questions whether the compiler should be included in PHP due to the cost of maintenance. He also said PHP users should "be aware that some bugfixes or version updates might take longer than what we're used to right now".

Additionally, PHP 8 as a major release may mean older PHP code could be broken after upgrading. However, Roose noted that most of the breaking changes were deprecated before the 7.x versions. 

Zend has also posted a reminder that PHP 7.2 is reaching end of life on November 30, 2020 and that means PHP core contributors won't be offering security fixes for that version of PHP anymore, which could spell trouble for enterprise web applications. 

SEE: Programming languages: Julia users most likely to defect to Python for data science

But PHP users can always pay a consultancy like Zend for long-term support and they will get patches after November 30. 

"For users of operating systems with long-term support offerings, your PHP binary often continues to receive patches by the OS vendor even once the community support window has ended," said Matthew Weier O'Phinney, an engineer at Zend.

"In the case of Ubuntu 18.04 and RHEL/CentOS 8, which each ship with PHP 7.2, this means you may continue to get patches going forwards. If the operating system you are on is not under an LTS policy, however, then your version will become vulnerable to new exploits as time progresses." 

Mark Story, a Sentry principal developer, who maintains PHP projects CakePHP and XHGui, said PHP 8 named parameters and union types provide ergonomic and correctness improvements. 

Named parameters allow methods to be called with parameters based on their name instead of just their order, explained Story.

"Named parameters help make calling methods that have many optional parameters easier to use, as you can specify only the parameters you're using by name," he told ZDNet.  

"This also helps with code readability down the road, as remembering what the sixth parameter to a method is harder than understanding what the 'expires' parameter might do."

Meanwhile, union types advance PHP's type system.

More on PHP and programming languages

  • Amazon: We're hiring software engineers who know programming language Rust  
  • 2020's fastest-rising tech jobs? Programming language PHP leads the way  
  • Microsoft: We're pulling the plug on Windows builds of programming language PHP  
  • Programming languages: Developers reveal what they love and loathe, and what pays best  
  • Programming languages: Julia users most likely to defect to Python for data science
  • One developer's favorite Mac coding tools for PHP and web development  
  • Linux Foundation: We'll host Mozilla's Rust programming language-based Servo web engine  
  • Programming language Python's popularity: Ahead of Java for first time but still trailing C  
  • Is Julia the next big programming language? MIT thinks so, as version 1.0 lands TechRepublic  
  • Mozilla's radical open-source move helped rewrite rules of tech CNET
  • Editorial standards