note 125654 added to language.types.null
| From: | Anonymous@php.net | Date: | Tue, 05 Jan 2021 03:44:19 +0000 |
| Subject: | note 125654 added to language.types.null | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216061@lists.php.net to get a copy of this message | ||
Note that if you do math on NULL, it will behave like 0.
echo 1 + NULL;
// 0
$n = NULL;
$n++;
echo $n;
// 1
But wait -- it gets better.
It works even if the variable doesn't exist:
unset($n);
$n++;
echo $n;
// 1
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.165 (proxied: 87.214.92.26)
----
Manual Page -- http://php.net/manual/en/language.types.null.php
Edit -- https://master.php.net/note/edit/125654
Del: integrated -- https://master.php.net/note/delete/125654/integrated
Del: useless -- https://master.php.net/note/delete/125654/useless
Del: bad code -- https://master.php.net/note/delete/125654/bad+code
Del: spam -- https://master.php.net/note/delete/125654/spam
Del: non-english -- https://master.php.net/note/delete/125654/non-english
Del: in docs -- https://master.php.net/note/delete/125654/in+docs
Del: other reasons-- https://master.php.net/note/delete/125654
Reject -- https://master.php.net/note/reject/125654
Search -- https://master.php.net/manage/user-notes.php