php8.5
Home/ Manual/ language / types/ Singleton types

Singleton types

Singleton types are those which allow only one value. PHP has support for two singleton types: false as of PHP 8.0.0 and true as of PHP 8.2.0.

Singleton types are those which allow only one value. PHP has support for two singleton types: false as of PHP 8.0.0 and true as of PHP 8.2.0.

Warning

Prior to PHP 8.2.0, the false type could only be used as part of a union type.

Note

It is not possible to define custom singleton types. Consider using enumerations instead.

Source: language/types/singleton.xml · from the official PHP manual (php/doc-en)