PHP 8.4 - a major update to the language

PHP 8.4 - a major update to the language

The new version includes many new features, such as property hooks, asymmetric property visibility, updates to the DOM API, improved performance, bug fixes, and much more.

Key changes

  • Property Hooks provide support for computed properties that can be understood by IDEs and static analysis tools without the need to write DocBlock comments that might not match. Additionally, they allow for reliable pre- or post-processing of values without the need to check whether a corresponding getter or setter exists in the class.
  • Asymmetric Visibility property recording can now be controlled independently of the read visibility of the property, reducing the need to use boilerplate getter methods to expose the value of a property without the possibility of it being changed from outside the class.
  • New #[Deprecated] Attribute extends the existing mechanism for declaring entities deprecated for user-defined functions, methods, and class constants.
  • New DOM API, which supports parsing HTML5 documents according to specifications, fixes several long-standing issues in DOM behavior, and adds several features that make working with documents more convenient. The DOM API is available in the Dom namespace. Documents using the new DOM API can be created with the DomHTMLDocument and DomXMLDocument classes.
  • New BcMathNumber Object allows the use of object-oriented style and standard mathematical operators when working with arbitrary precision numbers. These objects are immutable and implement the Stringable interface, so they can be used in string contexts, for example, echo $num.
  • New Functions array_find(), array_find_key(), array_any(), and array_all().
  • New Child Classes PdoDblib, PdoFirebird, PdoMySql, PdoOdbc, PdoPgsql, PdoSqlite drivers, inheriting PDO.
  • Properties and methods of a newly initialized object can now be accessed without wrapping the new expression in parentheses. Example: new MyClass()->method() without parentheses.
  • New classes, interfaces, and functions and much more…

Source: linux.org.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster