BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Articles Article Series: PHP 8.x

Article Series: PHP 8.x

PHP continues to be one of the most widely used scripting languages on the web, with 77.3% of all the websites whose server-side programming language is known using it, according to w3tech. PHP 8 brings many new features and improvements, which we shall explore in this article series.

PHP 8 is a major update to PHP that introduces new features and improvements in all of the language areas, such as expressions, classes, functions, operators, and more.

New expression-related syntax include attributes, match expression, the instanceof operator, and the new operator.

Speaking of new features related to classes, PHP 8 brings:

  • Enums,  a layer over classes to specify an enumerated list of possible values for a type 
  • The new readonly modifier for a class property, which makes the property unmodifiable after its initialization 
  • Constructor parameter promotion, useful to assign a constructor parameter value to an object property automatically.

PHP 8.0 also adds support for several functions- and methods-related features, including enhanced callables, named function arguments, and Fibers, interruptible functions adding support for multitasking.

Improvements to PHP type system include: union, intersection, and mixed types, as well as the static and never return types. Additionally, PHP 8 also brings support for true, null, and false stand-alone types.

 

Series Contents

1

PHP 8 - Attributes, Match Expression and Other Improvements

PHP 8 is a major update to PHP that introduces several new features and performance optimizations, including attributes, match expression, instanceof operator, new operator, a new JIT compiler, etc.

2

PHP 8 - Classes and Enums

In this article, we will review new PHP 8 features related to classes, including enums, the new readonly modifier for a class property, and constructor parameter promotion.   

3

PHP 8 – Functions and Methods

PHP 8.0 adds support for several functions- and methods-related features, including enhanced callables, named function arguments, and Fibers, interruptible functions adding support for multitasking.

4

PHP 8 - Type System Improvements

In this article we will discuss improvements to PHP types including union, intersection, and mixed types, as well as the static and never return types, and the true, null, and false stand-alone types.

5

PHP 8 - Arrays, Variables, Operators, Exception Handling and More

In this article, we discuss new features brought by PHP 8 related to arrays, variables, operators, and exception handling. We also discussed some trait-, class-, and function-related features. This article concludes the PHP 8 article series.

6

What's New in PHP 8.3

Besides performance improvements, PHP 8.3 brings a many new features, including amendments to the existing readonly feature; explicitly-typed class constants; a new #[Override] attribute, and more.

 

About the Author

Rate this Article

Adoption
Style

BT