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.

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

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


版本号 #2
由 壳壳虫 创建于 2026-10-31 17:48:00 UTC
由 壳壳虫 更新于 2026-10-31 17:48:01 UTC