PHP 8.3 Released
Written by Alex Armstrong   
Tuesday, 28 November 2023

PHP 8.3 has been released with improvements including explicit typing of class constants, deep cloning of readonly properties, and additions to randomness functionality.

PHP began life as a simple scripting language designed to build web pages but has developed into a general server side web language . It is now used for eight out of ten websites using server-side code. 


The first improvement to the new release is explicit typing of class constants. The developers say that not being able to declare constant types can be a source of bugs and confusion for class constants: By default, child classes can override class constants of their parents, so sometimes it is not easy to assume what the value and the type of a class constant really is, unless either their defining class or the constant itself is final. The new release adds support for declaring class, interface, trait, as well as enum constant types (collectively called “class constants”).

This release also adds support for fetching dynamic class constants. Previous versions of PHP supported various ways of looking up member's names, but no way to look up class constants. Support for this has now been added.

A new override attribute has also been added. When implementing an interface or inheriting from another class, PHP performs various checks to ensure that implemented methods are compatible with the constraints imposed by the interface or parent class, but hasn't been able to check whether a method is actually intended to implement the interface method or override the parent method or not. The new override attribute, when added to a method, causes the engine to validate that a method with the same name exists in a parent class or any of the implemented interfaces. If no such method exists, a compile time error is emitted.

Readonly properties have also received attention. These were added in PHP 8.1, but the developers say they had some shortcomings that have now been addressed. Specifically, non-readonly classes can now extend readonly classes, and readonly properties can be reinitialized during cloning.

PHP 8.3 is available for download now.


More Information

PHP Website

Related Articles

PhpStorm Updated For PHP 8.3

PHP Adds Read-Only Classes

PHP - Essential But Underappreciated

Ten Minutes to PHP

PHP Is Best?

PHP 8.0 Adds Metadata To Classes


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Dolt- A Version Controlled Database

A database that you can fork and clone, branch and merge, push and pull just like a git Repository. What is the use case for it?

Apple - Master Of Malicious Compliance

Apple is under pressure to open up its closed eco system, but it still has the power to resist. It is difficult to force a horse to drink and it is turning out very difficult to make Apple comply with [ ... ]

More News

raspberry pi books



or email your comment to:

Last Updated ( Tuesday, 28 November 2023 )