Skip to main content
InterviewHubPRO
Section Overview
Q37

Question 37 of 50

Part 3: Production Tuning, Asynchronous Workers & High Scale (25 - 35)

74%
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.
  • never return type: Explicitly marks functions that never return (always throw an exception or call exit()).