Info
Open the page on your phone

What is new in PHP 7 and PHP 8?

PHP 7:

  • Improved Performance: Significant performance improvements due to optimizations and innovations in the Zend Engine.
  • Scalar Type Declarations: The ability to specify types for scalar values (int, float, string, bool).
  • Return Type Declarations: Now you can specify the type that a function returns.
  • PHP 8:

  • Union Types: Allows specifying more than one type for arguments, variables, and function results.
  • Named Arguments: Enables passing function arguments by their names, making code more readable and understandable.
  • Attributes: Introduction of attributes for declaratively specifying metadata without using comments.
  • Nullsafe Operator: Operator for simplifying null checks.
  • Match Expression: A new way to use switch, more readable and powerful.