PHP & Zend Engine (50 Qs)•Part 3: Production Tuning, Asynchronous Workers & High Scale (25 - 35)
PHP Advanced Type System: Union Types, Intersection Types, and DNF Types.
senior LevelAsync & Promises
In Simple Words:
- Union Types (
T1 | T2): Accepts either Type 1 or Type 2 (int|float). - Intersection Types (
T1 & T2): Value must satisfy both interfaces simultaneously (Countable & Iterator). - Disjunctive Normal Form (DNF Types - PHP 8.2+): Combines unions and intersections with parentheses:
(HasTitle & HasAuthor) | null. neverreturn type: Explicitly marks functions that never return (always throw an exception or callexit()).