PHP 8 Improvements and New Features
Apart from JIT, we can expect many features and improvements with PHP 8. The following list is our handpicked selection of the upcoming additions and changes that should make PHP more reliable and efficient.
- Constructor Property Promotion
- Validation for Abstract Trait Methods
- Incompatible Method Signatures
- Arrays Starting With a Negative Index
- Union Types 2.0
- Consistent Type Errors for Internal Functions
- throw Expression
- Weak Maps
- Trailing Comma in Parameter List
- Allow ::class syntax on objects
- Attributes v2
- Named Arguments
- Nullsafe Operator
- Saner String to Number Comparisons
- Saner Numeric Strings
- Match Expression v2
- Stricter Type Checks for Arithmetic/Bitwise Operators
Whats new in PHP 8.0 some examples …
Finely the new PHP version 8 is out and it comes with lots of syntax sugar so developers can write code much faster and in more rebuts style. Lets have a look at some cool changes added to PHP 8. Looking at new syntax also bare in mind that this will crush your code when running on old engine of PHP.
PHP 8.0 examples
PHP 7
PHP 8
https://www.php.net/releases/8.0/en.php?fbclid=IwAR3Qso5iQL5eQ9h5sp49D58m1DH499_phv8uWMO3zIPdW3Cgryl3ugxaXds
https://kinsta.com/blog/php-8/#php-8-improvements-and-new-features