PHP is celebrating its 25th anniversary this year. It was first created by Rasmus Lerdorf as a way to track visits to his website.
The language started off as a set of Common Gateway Interface (CGI) binaries written in C, JetBrains explained in a blog post. The first suite of PHP scripts were named “Personal Home Page Tools,” or PHP Tools, though nowadays it is known by a recursive initialism: “PHP: Hypertext Preprocessor.”
The third iteration of PHP, released in 1998, was the result of Andi Gutman and Zeev Suraski rewriting the existing interpreter written by Lerdorf. This version, PHP 3.0, is the first version of PHP that resembles what the language looks like today, JetBrains explained. Together the two formed the company Zend, which continues to contribute to and be actively involved with PHP to this day.
The language continued to evolve over a 20-year time period, without a formal specification. It wasn’t until 2014 that a specification for PHP existed. The PHP Language Specification was developed internally at Facebook, and then transferred to the public domain.
In addition to this anniversary, PHP 8.0 is also expected to release this year. Brent Roose, programmer and /r/php moderator, has revealed upcoming features in PHP 8.0, which is expected to be released in December 2020. The first alpha of this version will be released on June 18. Roose, PHP 8.0 will introduce multiple breaking changes, as well as new features like the JIT compiler, union types, and attributes.
The JIT, or just in time, compiler has the potential to bring performance improvements to PHP, though no benchmarks have been made yet, Roose explained. PHP is an interpreted language, not a compiled one like C or Java, meaning that it gets translated to machine code at runtime. JIT compiles parts of the code at runtime so that a compiled version of the code can be used instead. Reasons for adding a JIT compiler to PHP are that it might enable it to see use as a performant language outside of web development contexts, and it can be improved over time, Roose said. A big downside, though, is that it will be complex to maintain.
Union types are “a collection of two or more types which indicate that either one of those can be used,” Roose wrote. He noted that there are a lot of use cases for union types since PHP is a dynamically-typed language.
Attributes allow developers to add metadata to classes without needing to parse docblocks. Attributes are commonly known as annotations in other languages, Roose added.
A full list of features and code examples is available here.