PHP 8.4.1, an update to the longstanding server-side web scripting language, has been released with features including an updated DOM API that makes it easier to work with HTML5 documents.
Accessible from php.net, PHP 8.4.1 was released November 21. The update also offers better performance, improved syntax, and improved type safety, according to php.net.
The new DOM API, available within the Dom
namespace, includes standards-compliant support for parsing HTML5 documents and fixes longstanding compliance bugs in the behavior of DOM functionality. It also adds functions to make it more convenient to work with documents. Using the new DOM API documents can be created using Dom\HTMLDocument
and Dom\XMLDocument
classes.
Also in PHP 8.4.1, a new BcMath\Number
object enables object-oriented usage and standard mathematical operators when working with arbitrary precision numbers. The objects are immutable and implement the Stringable
interface, enabling them to be used in string contexts like echo $num
.
With PHP 8.4.1, the scope to write to a property now may be controlled independently from the scope to read the property, reducing the need for boilerplate getter methods to expose a property’s value without allowing modification from the outside of a class. Also, property hooks now provide support for computed properties that can natively be understood by IDEs and static analysis tools, without needing to write docblock comments that might be out of sync.
Finally, new lazy objects also are featured in PHP 8.4.1. A lazy object is an object whose initialization is deferred until the state is observed or modified.
Predecessor PHP 8.3 arrived a year ago, bringing typing of class constants. It was followed by multiple point releases.