Connecticut Enjoy 70% Off Any Hosting First Three-Months
Websites & Ecommerce
Follow us on

Performance Comparison of PHP 8.2 vs PHP 8.1

Performance Comparison of PHP 8.2 vs PHP 8.1

This article presents a detailed on what is PHP, what is a PHP request, a comparison of the performance metrics between PHP 8.2, and PHP 8.1 across various CMSs and frameworks, and an overview of both. The purpose is to provide insights for beginners looking to learn more, website developers, and system administrators considering an upgrade to PHP 8.2.

What is PHP?

PHP stands for “PHP: Hypertext Preprocessor.” It’s a widely used, open-source scripting language. PHP scripts are executed on the server, making it fundamentally a server-side language. It’s particularly suited for web development and can be embedded into HTML, which allows developers to create dynamically generated web pages. PHP supports a wide range of databases, and it’s used for features like creating forums, picture galleries, surveys, and much more. Since its creation in 1994 by Rasmus Lerdorf, PHP has evolved significantly, offering a robust platform for web application development.

What is a PHP Request?

A PHP request is essentially an action initiated by a user or a system that prompts the PHP code to execute on the server. When you visit a website or click on a link that’s powered by PHP, your browser sends a request to the server hosting the website. This request tells the server to execute a specific PHP script. Depending on the script, PHP can generate HTML, access databases, manage sessions, and perform a wide range of tasks before sending the output back to the browser as a response. This process allows for dynamic content to be displayed on web pages, providing a tailored experience for users.

The performance data is based on benchmark tests conducted using the Apache HTTP server benchmarking tool in a controlled environment.

Performance Comparison

The following tables compare the performance of PHP 8.2 and PHP 8.1:

1. CMS Performance Comparison

CMS/FrameworkPHP 8.1 req/sPHP 8.2 req/sObservation
WordPress153158Slight Improvement
Joomla274265Slight Decrease
Craft CMS358354Slight Decrease
OpenCart151154Slight Improvement

2. Framework Performance Comparison

FrameworkPHP 8.1 req/sPHP 8.2 req/sObservation
Laravel611670Significant Boost
CodeIgniter11201180Noticeable Boost

PHP 8.1 and 8.2: An Overview and Differences

PHP 8.1

PHP 8.1, released in November 2021, introduced several notable features and improvements to the language. Key highlights include:

  • Enumerations (Enums): Support for enums allows for defining a set of named values, improving code readability and safety.
  • Fibers: Introduces a low-level mechanism for implementing lightweight threads (fibers), enabling easier management of asynchronous operations.
  • Readonly Properties: These properties ensure that once a property is initialized, it cannot be modified, enhancing the immutability of objects.
  • Array Unpacking with String Keys: Extends the array unpacking feature to support arrays with string keys.
  • First-class Callable Syntax: Simplifies the syntax for working with callable types, making the code more concise and readable.

PHP 8.2

Released in November 2022, PHP 8.2 continued the trend of adding features and making improvements, such as:

  • Disjunctive Normal Form Types: PHP 8.2 introduces more flexible type declarations for parameters, properties, and return types, allowing for combinations of types using “or” conditions.
  • Readonly Classes: Expanding on the read-only properties introduced in 8.1, this feature allows entire classes to be declared as read-only, ensuring that all their properties are immutable after initialization.
  • Fetch Properties of String-Backed Enums in Const Expressions: This enhancement relates to enum usability, making it easier to work with string-backed enums.
  • New Random Extension: The introduction of a dedicated random extension improves the way random numbers are generated, making it more reliable and secure.
  • Deprecations and Removals: As with every new release, PHP 8.2 deprecates older features and behaviors to streamline the language and prepare for future improvements.

Key Differences

The transition from PHP 8.1 to 8.2 reflects a continued focus on performance, security, and developer productivity. Key differences lie in the introduction of read only classes, more flexible type systems, and enhancements in enum usability in PHP 8.2, alongside the new random number generation mechanism. Each release deprecates outdated practices in favor of more efficient, secure, and readable code.

PHP’s evolution, particularly in its recent versions, underscores the language’s commitment to adapting to modern programming paradigms and developer needs, ensuring its relevance and utility in web development.


The performance of PHP 8.2 varies across different CMSs and frameworks. In some cases, such as Laravel and Drupal, PHP 8.2 exhibits noticeable improvements. However, there are instances, like with Joomla and Craft CMS, where PHP 8.2 shows a slight decrease in performance. This data is crucial for making informed decisions about upgrading to PHP 8.2.

Related Posts
Skip to content