A Sneak Peek into Latest PHP 8.3 Update: Release Date, New Features, & Improvements

Maulik Shah

By : Maulik Shah

A Sneak Peek into Latest PHP 8.3 Update: Release Date, New Features, & Improvements1


PHP 8 was released on November 26, 2020, with many interesting features like match expression, attributes, union types, null safe operator, JIT, named arguments, etc. All of these features add more to the already popular programming language.

Now, with the upcoming release of PHP 8.3, you can expect more additions to it. The update is expected to release on November 23, 2023, after it has passed 3 alpha and beta releases.

So, what are some new features to expect from this release? In this blog post, I have enlisted all of it. But before we do so, let’s give you a little background knowledge about PHP server and PHP as a programming language.

Learn These PHP Facts First!

PHP Vs PHP 8 Popularity

PHP Vs PHP 8 Popularity

Percentage of Websites Using PHP & PHP v8

  • About 77.5% of all the present websites are built on PHP, that’s how popular PHP is! PHP version 8 is used by approximately 7.7% of all websites whose server-side language is known.
  • Now that different sub-versions of PHP 8 have been released, let’s check how they are being used in the present market. Amongst all the websites using PHP 8, about 57.4% use PHP 8.0, 39.3% use v8.1, and about 3.2% use PHP 8.2.

PHP 8 Sub-version Usage Statistics

PHP 8 Sub-version Usage Statistics

Percentage of Websites Using Subversions of PHP 8

  • PHP is a general-purpose, open-source scripting language used dedicatedly for developing websites and web applications.
  • Initially, its full form was Personal Home Page. But today, it is an acronym for PHP: Hypertext Preprocessor.
  • It works seamlessly with other programming languages such as Javascript, HTML, and databases like Oracle, MySQL, PostgreSQL, etc.

When Will PHP 8.3 Release?

Are you wondering when it will be released completely and will be available for public use? Here’s the release schedule for you to check!

Release Date Type
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


Curious to know what PHP 8.3 has in store for developers and businesses that depend on it? Let’s dive right into it!

New PHP 8.3 Features to Expect


Addition of new json_validate() function

A JSON string consists of a specified data format. It doesn’t include any methods but only properties. Writing a JSON string needs you to write a string in double quotes. If you write it in single quotes, it isn’t valid.

Until now, if you wanted to validate a JSON string, you would have to use the function json_decode(). You would have to write something like this:

$json = '{"name": "Alicia Joe"}';
$data = json_decode($json); // function to validate JSON
if (json_last_error() === JSON_ERROR_NONE) {
// Valid JSON
} else {
// Invalid JSON

With the release of PHP 8.3, you can now use the method json_validate( ) as follows:

$json = '{"name": "Alicia Joe"}';
$valid = json_validate($json);
if ($valid) {
// Valid JSON
} else {
// Invalid JSON

If you compare the two pieces of code, you can see that using the json_validate( ) method is much more easy and simple. If it is a valid JSON string, it returns true. Otherwise, it returns a False.

Here, you also don’t have to be dependent on the json_last_error() function. Check out the signature of the json_validate() function mentioned below:

json_validate(string $json, int $depth = 512, int $flags = 0): bool

Here, $json is the JSON string that needs to be validated, $depth is the nesting depth (maximum) of the decoding structure, $flags is the bitcode of decode flags.

Unserialize() error handling improvement

Catching errors and exceptions will be much easier with the release of PHP 8.3. Up until now, you would get an E_WARNING or E_NOTICE in case of an error or it would simply throw arbitrary errors and exceptions.

You had to write something like this for error handling:

try {
set_error_handler(static function ($severity, $message, $file, $line) {
throw new \ErrorException($message, 0, $severity, $file, $line);
$result = unserialize($serialized);
} catch (\Throwable $e) {
// Unserialization failed. Catch block is optional in case the error shouldn’t be handled.
} finally {

Here, you needed to set an error handler, catch exceptions, and restore the error handler. You can’t even guarantee that the restore error handler option will function seamlessly in case of exception. It can be a lot of hassle.

However, the new PHP 8.3 comes with an improved unserialize( ) function. Thus, if your unserialize( ) method fails, it will throw an UnserializationFailedException. The E_WARNING or E_NOTICE will be converted into exceptions , wrapped in an instance of UnserializationFailedException. It makes catching and handling errors much easier.

So, instead of writing the aforementioned snippet of code, you can use the unserialize method like this:

try {
$result = unserialize('B:2:"jon";');
// Do something with the $result.
} catch (\UnserializationFailureException $e) {
// unserialization failed.

New function in Randomizer class

Several methods are proposed for the class \Random\Randomizer. With the help of these functions, you will have better opportunities of creating random values. Here, look at some of these functions added in the PHP last version.

I. getBytesFromString( ) function

Random string generation

This method can be used on multiple occasions. For example, you can generate a string of desired length from randomly chosen bytes of a string. Consider the following code for better understanding:

$randomizer = new \Random\Randomizer();
$randomizer->getBytesFromString('abcdef', 3); // 'bda'

Here, we have given the length as 3 and the function has randomly selected three bytes from the provided string.

Creating multi factor authentication code

$randomizer = new \Random\Randomizer();
implode('-', str_split($randomizer->getBytesFromString('0123456789', 20), 5))
// string(23) "09292-16502-59535-88886"

Creating a subdomain name randomly

$randomizer = new \Random\Randomizer();
$randomizer->getBytesFromString('abcdefghijklmnopqrstuvwxyz', 10) . '.example.com'
// string(20) "jxqzjxqzjx.example.com"

Creating a DNA sequence

$randomizer = new \Random\Randomizer();
$randomizer->getBytesFromString('ATGC', 30)

II. getfloat( ) method

public function getFloat(
float $min,
float $max,
IntervalBoundary $boundary = IntervalBoundary::ClosedOpen
): float {}

Getting a random float number

This function is utilized to randomly get a float number between any two provided numbers. Here, check out the code for your reference:

$randomizer = new \Random\Randomizer();
$randomizer->getFloat(0, 1); // 0.123456789

Generating latitude and longitude randomly

$randomizer = new \Random\Randomizer();
$randomizer->getFloat(-90, 90, \Random\IntervalBoundary::ClosedClosed),
$randomizer->getFloat(-180, 180, \Random\IntervalBoundary::OpenClosed)
// Lat: float(-45.123456789)
// Long: float(123.123456789)

III. nextfloat( ) function


public function nextFloat(): float {}

Generating a float number between the numbers 0 and 1 randomly

$randomizer = new \Random\Randomizer();
$randomizer->nextFloat(); // 0.123456789
$randomizer->nextFloat(); // 0.987654321

Of course, it might look similar to the getfloat() method, but it is strictly used for generating a random float number between 0 and 1.

Simulating a coin flip

$randomizer = new \Random\Randomizer();
$randomizer->nextFloat() > 0.5 ? 'Heads' : 'Tails'
// string(5) "Tails"

Simulating a dice roll

$randomizer = new \Random\Randomizer();
(int) ($randomizer->nextFloat() * 6) + 1
// int(3)

Dynamic fetching of Class constant

Up until now, PHP did support dynamic or computed functions and properties.

//Calling variables dynamically
$baz = 'foo';
$$baz = 'bar';
// $foo

// Calling class functions dynamically
class Foo
public function hello()
echo 'Hello world!';
$dynamicMethod = 'hello';
$a = new Foo();
$a->{$dynamicMethod}(); //prints 'Hello!'

However, calling class constants dynamically was not possible yet. But, not anymore! In PHP 8.3, you can expect this feature to be present.

class Foo
public const BAR = 'bar';
$dynamicConstant = 'BAR';
echo Foo::{$dynamicConstant};
//prints 'bar'

In case you are trying to access a constant that does not exist, it will throw an error like mentioned below.

class Foo {}
$bar = 'BAR';
echo Foo::{$bar};
// Error: Undefined constant Foo::BAR

Improved Date/Time Exceptions

With PHP 8.3, some of the date/time exceptions are expected to improve sufficiently. If you see, most of these exceptions are very generic and don’t provide much information about these errors, making it quite difficult to catch them.

But in the PHP 8.3 update, this issue will be addressed as more specific exceptions will be present. For instance, these errors will be available.

  • Invalid serialization data for DateTime object, DateTimeImmutable object, DateTimeZone object, and DatePeriod object.
  • Can’t modify readonly property DatePeriod::$%s
  • A warning for bad or unknown format (%s) at position %d (%c) at the time of unserializing: %s
  • Error during comparison of uninitialized DateTimeZone objects
  • An iterator can’t be used with foreach by reference
  • ValueError
  • TypeError
  • DateError such as DateObjectError and DateRangeError.


  • DateException such as DateInvalidTimeZoneException, DateInvalidOperationException, DateMalformedStringException, DateMalformedIntervalStringException, and DateMalformedPeriodStringException.

While these are some of the most notable features and updates you will get to enjoy with the new update, there are some backward compatibility issues as well that you have to note.

Backward Compatibility Issues to Note During PHP 8.3 Update

  • Instead of a generic ValueError, you will now get a DateRangeError in case of “Epoch doesn’t fit in a PHP integer” error. If you use a 32-bit system, that might be an issue.
  • For “Only non-special relative time specifications are supported for subtraction” warning, you have DateInvalidOperationException with functions like date_sub() and DateTime::sub(). If you leave it with a NULL return value or warning, it won’t be any useful.


The new PHP 8.3 version is expected to bring a lot of new features and improvements to the already powerful scripting language. Such as Randomizer additions, json() validate, unserialize() error handling. But more than that, it is going to be an exceptional update for coders and testers who have to work their brains in understanding generic errors and exceptions.

With the inclusion of specified error and exception suggestions, you will be able to catch errors and rectify the code seamlessly. Want to know how you can leverage this update to code better software products? Our developers can help you with that.

With our 16+ years of experience and rich industry skills, we are well aware of the ins and outs of PHP development. Let’s connect to discuss more!


What is the current PHP version?

The latest PHP version as of now is PHP 8.2, which was released on 24th November, 2022.

What are different PHP versions?

There are several PHP versions available in the market right from PHP 1 to PHP 8.2, which is the latest version. PHP 8.3 is expected to be released in November, 2023.

Which is better, PHP 7.4 or 8?

As per statistics, PHP 8 handled 20.16% per second requests more than PHP 7.4. Also, PHP 8 is faster, with less coding, better typing, syntax, and type safety, making it the better choice. Moreover, PHP 7.4 is now out of support as of 28th November, 2022. So, if you want to upgrade PHP 7.3 to 8 or PHP 7.4 to 8, it is for the best.

Befriend Technology for Transformation

Selecting the right technology is pivotal to your business’s growth and success. Have you already decided the suitable one for your next project? If so, we can help you take the next step. If not, we can help you decide the best option. Connect with the Top 1% pre-vetted software engineers to build your software.

Get Free Consultation

    ✓ 100% Guaranteed Security of Your Information