note 129913 added to language.types.value
| From: | kernamon.workstation@gmail.com | Date: | Fri, 13 Dec 2024 13:18:19 +0000 |
| Subject: | note 129913 added to language.types.value | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221718@lists.php.net to get a copy of this message | ||
While null is often treated as a special value in PHP, it is not officially listed as a "value
type" in the same way as false and true are in PHP 8+ versions. But null can still be used in
types, particularly as part of union types, but it is not itself defined as a value type according
to the official PHP documentation.
EXPLANATION:
Value types in PHP not only check the type of a value but also the value itself. PHP supports two
value types introduced in specific versions:
false as of PHP 8.0.0
true as of PHP 8.2.0
CONCLUSION:
Prior to PHP 8.2.0, false could only be used as part of a union type, not as a standalone type.
Regarding null, null remains a special value and can be part of union types but null is not
considered a value type like false and true in this context.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 193.49.48.244)
----
Manual Page -- https://php.net/manual/en/language.types.value.php
Edit -- https://main.php.net/note/edit/129913
Del: integrated -- https://main.php.net/note/delete/129913/integrated
Del: useless -- https://main.php.net/note/delete/129913/useless
Del: bad code -- https://main.php.net/note/delete/129913/bad+code
Del: spam -- https://main.php.net/note/delete/129913/spam
Del: non-english -- https://main.php.net/note/delete/129913/non-english
Del: in docs -- https://main.php.net/note/delete/129913/in+docs
Del: other reasons-- https://main.php.net/note/delete/129913
Reject -- https://main.php.net/note/reject/129913
Search -- https://main.php.net/manage/user-notes.php