No DNF For Catch¶
<?php
try {} catch (A&B $e) {}
try {} catch (A|(B&C) $e) {}
Catch clauses accept multiple types of exceptions, since PHP 7.1: they are listed with the ‘|’ separator.
This looks like the union type of PHP 8.0, and actually acts like it.
Yet, this is not a normal type, because the intersectional and the DNF format are not supported at parsing time. Thus, the two expressions below generate an error.
See Also¶
No DNF [Try me]
PHP Features¶
Last updated: 14 July 2026