PHP 8.4 introduces several new features and enhancements aimed at improving usability, performance, and developer productivity.
This new php update will contain the following updates:
1. Asymmetric Visibility
This new feature allows developers to define different access levels for reading and writing properties. For example, a property can be publicly readable but writable only within the class. This enhances control over object properties and is particularly useful for encapsulation.
2. Array Helper Functions
PHP 8.4 introduces several native array utility functions:
• array_find(): Finds the first element that satisfies a given condition.
• array_find_key(): Retrieves the key of the first matching element.
• array_any() and array_all(): Check if any or all elements in an array meet a condition, respectively. These functions make array manipulation more intuitive and eliminate the need for third-party libraries.
3. Improved String Handling
New functions like mb_ucfirst, mb_trim, and grapheme_str_split improve support for multi-byte and internationalized strings. These updates help developers handle complex text processing tasks with less custom code.
4. HTML5 Support
PHP now includes a \Dom\HTMLDocument class for native HTML5 parsing, making it easier to work with modern web structures while maintaining backward compatibility with older parsing methods.
5. Lazy Object Initialization
Native support for lazy objects allows developers to defer object instantiation until they are accessed, improving performance and reducing memory usage in resource-intensive applications.
6. Exit and Die as Functions
The exit() and die() commands are now treated as proper functions. This improves consistency and allows these commands to support features like named arguments and strict typing.
7. Bcrypt Security Update
The default cost for bcrypt hashing has been increased from 10 to 12, making password hashing more secure by requiring more computational effort for cracking attempts.
8. Implicit Nullable Types Deprecated:
PHP now requires explicit nullable type declarations (?TypeName) instead of inferring nullability from default values. This change reduces ambiguity and ensures clearer code.
9. Object-Oriented API for BCMath:
PHP introduces an object-based API for BCMath, allowing arithmetic operations with overloaded operators. This simplifies numeric computations compared to the previous functional approach.
10. Hooks in Interfaces:
Interfaces now support property hooks, improving flexibility and enabling direct property definitions within interfaces.
These updates collectively aim to streamline development workflows and modernize PHP’s feature set.
Php 8.4 will be released on November 21.
This new php update will contain the following updates:
1. Asymmetric Visibility
This new feature allows developers to define different access levels for reading and writing properties. For example, a property can be publicly readable but writable only within the class. This enhances control over object properties and is particularly useful for encapsulation.
2. Array Helper Functions
PHP 8.4 introduces several native array utility functions:
• array_find(): Finds the first element that satisfies a given condition.
• array_find_key(): Retrieves the key of the first matching element.
• array_any() and array_all(): Check if any or all elements in an array meet a condition, respectively. These functions make array manipulation more intuitive and eliminate the need for third-party libraries.
3. Improved String Handling
New functions like mb_ucfirst, mb_trim, and grapheme_str_split improve support for multi-byte and internationalized strings. These updates help developers handle complex text processing tasks with less custom code.
4. HTML5 Support
PHP now includes a \Dom\HTMLDocument class for native HTML5 parsing, making it easier to work with modern web structures while maintaining backward compatibility with older parsing methods.
5. Lazy Object Initialization
Native support for lazy objects allows developers to defer object instantiation until they are accessed, improving performance and reducing memory usage in resource-intensive applications.
6. Exit and Die as Functions
The exit() and die() commands are now treated as proper functions. This improves consistency and allows these commands to support features like named arguments and strict typing.
7. Bcrypt Security Update
The default cost for bcrypt hashing has been increased from 10 to 12, making password hashing more secure by requiring more computational effort for cracking attempts.
8. Implicit Nullable Types Deprecated:
PHP now requires explicit nullable type declarations (?TypeName) instead of inferring nullability from default values. This change reduces ambiguity and ensures clearer code.
9. Object-Oriented API for BCMath:
PHP introduces an object-based API for BCMath, allowing arithmetic operations with overloaded operators. This simplifies numeric computations compared to the previous functional approach.
10. Hooks in Interfaces:
Interfaces now support property hooks, improving flexibility and enabling direct property definitions within interfaces.
These updates collectively aim to streamline development workflows and modernize PHP’s feature set.
Php 8.4 will be released on November 21.
What's new in PHP 8.4 - stitcher.io
Features, performance upgrades, and deprecations in PHP 8.4
stitcher.io