Advanced PHP
Q74 / 100

What are PHP intersection types (PHP 8.1)?

Correct! Well done.

Incorrect.

The correct answer is B) A type declaration requiring a value to satisfy multiple type constraints simultaneously: Iterator&Countable

B

Correct Answer

A type declaration requiring a value to satisfy multiple type constraints simultaneously: Iterator&Countable

Explanation

function f(Iterator&Countable $x) requires $x to implement both Iterator and Countable. Intersection types are the dual of union types.

Progress
74/100