October 11, 2023
Starting today, users of our cloud hosting platform and servers using the Hepsia Control Panel can activate PHP 8.3 for testing on their websites.
By utilizing Hepsia's feature for assigning distinct PHP versions to different hosts, they can run a trial version of their site to assess its compatibility with the latest PHP release.
It's important to note that PHP 8.3 is currently in the 'Release Candidate' phase, indicating that it's not yet officially released but is in a state of readiness for broader use. Nevertheless, it's not advisable for production purposes.
What's new in PHP 8.3?
With each new PHP version, developers gain tools that simplify their workflows, enhance code quality, and boost application performance. While PHP 8.3 doesn't introduce significant changes compared to PHP 8.1 and 8.2, it excels in cleaning up the language and streamlining the web application development process. Here's a quick overview of some of the additions in PHP 8.3:
- 1. json_validate() Function: PHP 8.3 brings a new json_validate() function, designed to offer a more efficient alternative to json_decode(). This function enables developers to validate JSON strings using predefined schemas, ensuring data accuracy and consistency. It reduces the risk of errors associated with custom validation procedures.
- 2. Typed Class Constants: This is a fresh feature enforcing strict data type declarations for class constants. Developers can explicitly define the data type for constants, eliminating the need for PHP to infer it based on the constant's value.
- 3. Dynamic Class Constants and Enum Member Fetch Support: PHP 8.3 introduces Dynamic Class Constants, allowing developers to assign values to class constants using expressions. This dynamic aspect enhances the adaptability and versatility of class constants.
- 4. New Random Extension Methods: The Random extension in PHP 8.3 includes new methods for generating customized random data. These methods are particularly useful for cryptographic secure pseudo-random number generation (CSPRNG). They include getBytesFromString for generating random bytes from a given string and getFloat() and nextFloat() for obtaining high-precision random floating values.
- 5. #[\Override] Attribute: The #[\Override] attribute helps in code upgrades by explicitly marking child methods that intentionally override parent methods. When used, the PHP compiler checks whether the method exists in the parent class or any implemented interface. This feature prevents compile-time errors and enhances code maintenance.
- 6. Negative Indices in Arrays: In PHP versions before 8.3, when the first element in an array was negative, the second element defaulted to 0. In PHP 8.3, the second element defaults to the next negative value in the array. For example, if the first element is -8, the following element will be -7, not 0.
For a complete list of new features and bug fixes in PHP 8.3, refer to the latest release candidate documentation.
What are the steps to transition to the official PHP 8.3 version once it's available?
After PHP 8.3 is officially released on our platform, you can update your entire account to PHP 8.3 using the following instructions:
- 1. Visit the Advanced section in the Hepsia Control Panel.
- 2. Go to the PHP Settings section.
- 3. Choose PHP 8.3 from the "Select PHP version" drop-down menu.
PHP 8.3 brings forth several significant improvements aimed at enhancing development quality.
If you decide to transition to PHP 8.3, set to be officially launched on November 23, it is strongly advised that you thoroughly review the official PHP documentation to gain a comprehensive understanding of the new features and their associated benefits.