PHP @ 30 still evolving, adds pipe operator, maybe generics • The Register

The PHP team is considering adding a partial implementation of generics to the language, has confirmed that a pipe operator will be in the forthcoming 8.5 release, and has formally adopted the FrankenPHP app server into the PHP Foundation.

PHP, which originally stood for Personal Home Page, was first released by inventor Rasmus Lerdorf in June 1995. 30 years on, its usage is growing, it powers more than 70 percent of websites using server-side programming (largely thanks to WordPress and other content-management systems), and the language is acquiring major new features.

Last month the PHP Foundation reported on the introduction of the pipe operator in PHP 8.5, expected in November. The operator will be represented as |> and will pass the value on the left hand side to become an argument to a function on the right hand side. This can be chained to form a pipeline, enabling concise programming that is more readable than nested parentheses. The pipe operator in PHP 8.5 is similar to that in F#.

According to the post from Larry Garfield, a member of the PHP-FIG (framework interop group) core committee, the work on the pipe operator may also enable partial function applications, another common feature in functional programming languages such as F#.

The latest news is that compile-time generics are under consideration, though only on interfaces and abstract classes, with a request to the community for feedback. The response so far is mixed, with a highly upvoted comment that a partial implementation of generics would mean that “PHP will be stuck forever with half-baked feature that, arguably, doesn’t even cover 50 percent of its usage.” 

It is already possible to simulate generics using PHPStan or Psalm, widely used static analysis tools that support templated annotations.

Another recent PHP development is that the FrankenPHP application server has been adopted by the PHP Foundation, which supports PHP development, and is now part of the official PHP organisation on GitHub. FrankenPHP is written in Go and combines the PHP executor with the Caddy web server, achieving better performance for PHP applications as well as Caddy benefits such as automatic TLS certificates.

The initial success of PHP was driven by its simplicity as a dynamically typed language, and the fact that every web host offered it, making it a favorite for hobbyist and small business developers. PHP can still be used in an undisciplined manner, but modern PHP has added features such as steadily improved strict typing and a JIT (just-in-time) compiler, available since PHP 8.0 in 2020.

PHP usage is at 18.9 percent overall and 19.1 percent for professional developers, according to a recent StackOverflow survey, fractionally up year on year. The most popular PHP framework (WordPress aside) is Laravel, with 8.9 percent usage (across all technologies), up from 7.9 percent in 2024.

PHP is still not the most elegant of languages, and it suffers from the fact that many websites use old versions: according to w3techs 48.1 percent of websites still use PHP 7 and over 10 percent PHP 5, for which support ended 6 years ago, though we would guess that many of these sites are tiny or abandoned.

Nevertheless, like Ruby on Rails and Python-based web frameworks, PHP may be benefiting from developers disillusioned with the notion of JavaScript or TypeScript everywhere. ®

Leave a Comment