The New PHP 8 & Download
PHP is one of the most popular programming languages in the world. Some think php is going to be weak in the next five years, but it's going to be weak really?
PHP on November 26, 2020, version 8 was released, and there are many different things compared to the previous generation
The Different Things :
Named arguments
Specify only required parameters, skipping optional ones.
Arguments are order-independent and self-documented.
Attributes
Instead of PHPDoc annotations, you can now use structured metadata with PHP's native syntax.
Constructor property promotion
Less boilerplate code to define and initialize properties.
Union types
Instead of PHPDoc annotations for a combination of types, you can use native union type declarations that are validated at runtime.
Match expression
The new match is similar to switch and has the following features:
Match is an expression, meaning its result can be stored in a variable or returned.
Match branches only support single-line expressions and do not need a break; statement.
Match does strict comparisons.
Null safe operator
Instead of null check conditions, you can now use a chain of calls with the new nullsafe operator. When the evaluation of one element in the chain fails, the execution of the entire chain aborts and the entire chain evaluates to null.
Saner string to number comparisons
When comparing to a numeric string, PHP 8 uses a number comparison. Otherwise, it converts the number to a string and uses a string comparison.
Consistent type errors for internal functions
Most of the internal functions now throw an Error exception if the validation of the parameters fails....etc
The Reference => PHP Released
Features and improvements:
- Union Types
- Named Arguments
- Match Expressions
- Attributes
- Constructor Property Promotion
- Null safe Operator
- Weak Maps
- Just In Time Compilation
- And much much more...
To Download PHP 8:
I hope enjoy it.
0 Comments
Post a Comment