Chapter 4: Scalar, Arrays, and Special Types

Welcome to Section 2. In this part of the book, we are going to look at something that has become much more of a first-class feature in modern PHP: types.

The release of PHP 7 marked a significant turning point in the history of PHP. It ended a long period of stagnation that included the abandonment of a whole version – PHP 6. With PHP 7, we got some significant and highly useful changes to the language, and one of those was the introduction of scalar type declarations:

PHP: New features - Manual

https://www.php.net/manual/en/migration70.new-features.php

PHP 7 brought the advent of scalar type hints and strict type checking. This allowed us to write code with a clearer API and built-in assurances ...

Get The Art of Modern PHP 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.