How to use Union Types in PHP

Published On2020-07-24

PHP 8 Union Types

One of the most exciting features in PHP 8.0 is Union Types. Union Types allow you to declare a type constraint as a union of two or more types.

Recent Articles on PHP.Watch

All ArticlesFeed
GitAttributes for PHP Composer Projects

GitAttributes for PHP Composer Projects

How to use a `.gitattributes` file to reduce the package size of Composer packages.
Performance Impact of PHP Exceptions

Performance Impact of PHP Exceptions

A benchmark on the performance cost of throwing and handling PHP exceptions
Private Composer Repositories with GitLab

Private Composer Repositories with GitLab

How to create a private Composer repository with GitLab Package Registry.
Subscribe to PHP.Watch newsletter for monthly updates

You will receive an email on last Saturday of every month and on major PHP releases with new articles related to PHP, upcoming changes, new features and what's changing in the language. No marketing emails, no selling of your contacts, no click-tracking, and one-click instant unsubscribe from any email you receive.