PHP 8.3: new features (with RFCs) and release date.
Hundreds of developers subscribed to my newsletter.
Join them and enjoy free content about the art of crafting websites!
PHP is an open-source project. Knowing what’s going on for the next version only takes a minute of research. For instance, this page lists all the accepted RFCs for PHP 8.3.
Below, you will find a condensed list of what’s new, with code samples that make sense.
Table of contents

When will PHP 8.3 be released?
According to the preparation tasks list, PHP 8.3 will be released on November 23, 2023, after three alpha releases, three beta, and six release candidates.
Date | Release |
---|---|
June 8, 2023 | Alpha 1 |
June 22, 2023 | Alpha 2 |
July 6, 2023 | Alpha 3 |
July 18, 2023 | Feature freeze |
July 20, 2023 | Beta 1 |
August 03, 2023 | Beta 2 |
August 17, 2023 | Beta 3 |
August 31, 2023 | RC 1 |
September 14, 2023 | RC 2 |
September 28, 2023 | RC 3 |
October 12, 2023 | RC 4 |
October 26, 2023 | RC 5 |
November 9, 2023 | RC 6 |
November 23, 2023 | GA |
What’s new in PHP 8.3: new features and changes
json_validate()
Instead of using json_decode()
to validate a JSON string, you can now use json_validate()
. According to its RFC, it also consumes fewer resources.
json_validate('{ "foo": "bar", }'); // Syntax errorecho json_last_error_msg();
As you can see, json_validate()
returns a boolean
, and you can fetch the error message with json_last_error()
or json_last_error_msg()
for more details.
Learn more: PHP RFC: json_validate
Improved unserialize()
error handling
This proposal aims to improve the error handling in PHP’s unserialize()
function, which is inconsistent and hard to handle reliably.
Depending on the input string, PHP 8.2 may emit an E_NOTICE
, an E_WARNING
, or throw an arbitrary exception or fatal error.
This can make it challenging for developers to manage errors that occur during unserialization.
The proposed solution has two parts:
- Add a new
UnserializationFailedException
in PHP 8.3. This allows developers to use a catch block for it and handle all possible errors during the process. - Increase the error reporting severity in the unserialize() parser in PHP 9.0 so that all cases emit an
E_WARNING
or throw the newUnserializationFailedException
.
Learn more: PHP RFC: Improve unserialize() error handling
Randomizer additions
This RFC proposes to add three new methods to \Random\Randomizer
and an enum called IntervalBoundary
, which is used in one of the methods:
final class Randomizer { public function getBytesFromString(string $string, int $length) : string {} public function nextFloat() : float {} public function getFloat(float $min, float $max, IntervalBoundary $boundary = IntervalBoundary::ClosedOpen) : float {}} enum IntervalBoundary{ case ClosedOpen; case ClosedClosed; case OpenClosed; case OpenOpen;}
Learn more: PHP RFC: Randomizer Additions
Dynamic class constant fetch
This RFC proposes to allow class constants to be accessed dynamically using variables.
Instead of accessing class constants with a static string value (e.g. ClassName::CONSTANT
), you could use a variable containing the constant name.
$constant = 'CONSTANT'; ClassName::{$constant}
This change would make it easier to access class constants dynamically and programmatically.
Learn more: PHP RFC: Dynamic class constant fetch
More appropriate Date/Time exceptions
The RFC proposes introducing specific date and time exceptions in PHP where it makes sense.
Currently, there are warnings, errors or a basic “Exception”, which are not specific enough.
There will be different exceptions for errors, such as DateInvalidTimeZoneException
, DateInvalidOperationException
, and DateMalformedStringException
.
Learn more: PHP RFC: More Appropriate Date/Time Exceptions
Read only amendments
In PHP 8.2, you couldn’t lift the restriction when extending a readonly class.
Here’s an example:
readonly class A {} // Fatal error: Non-readonly class B cannot extend readonly class Aclass B extends A {}
Starting from PHP 8.3, this won’t throw a fatal error anymore. 👍
However, the inverse still remains as it is.
class A {} // Fatal error: Readonly class B cannot extend non-readonly class Areadonly class B extends A {}
Learn more: PHP RFC: Read only amendements
That’s it for PHP 8.3 so far. 👍
I will report every newly accepted RFC in the coming months!
Subscribe to my newsletter and follow me on Twitter to make sure you don’t miss anything!