note 78516 added to function.unset
| From: | Maresa at osu1 dot php dot net | Date: | Tue, 16 Oct 2007 00:41:59 +0000 |
| Subject: | note 78516 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131413@lists.php.net to get a copy of this message | ||
Note that since unset() returns void, you can't do this:
isset($some_var) && unset($some_var);
You'll get: Parse error: syntax error, unexpected T_UNSET in ...
The reason is because it would parse as
<bool> && <void>;
which is not a valid PHP statement.
Thus, the only alternative is to actually use if statement.
----
Server IP: 208.69.120.35
Probable Submitter: 64.124.65.175
----
Manual Page -- http://www.php.net/manual/en/function.unset.php
Edit -- https://master.php.net/note/edit/78516
Del: integrated -- https://master.php.net/note/delete/78516/integrated
Del: useless -- https://master.php.net/note/delete/78516/useless
Del: bad code -- https://master.php.net/note/delete/78516/bad+code
Del: spam -- https://master.php.net/note/delete/78516/spam
Del: non-english -- https://master.php.net/note/delete/78516/non-english
Del: in docs -- https://master.php.net/note/delete/78516/in+docs
Del: other reasons-- https://master.php.net/note/delete/78516
Reject -- https://master.php.net/note/reject/78516
Search -- https://master.php.net/manage/user-notes.php