note 77076 added to function.isset
| From: | codeslinger at compsalot dot com | Date: | Tue, 14 Aug 2007 03:31:43 +0000 |
| Subject: | note 77076 added to function.isset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129462@lists.php.net to get a copy of this message | ||
The behavior of isset is complex and the results are sometimes not what people expected -- to their
peril.
After dealing with isset() for awhile and peppering my code with additional checks for edge cases.
I eventually got to know and love empty()
Most of the places that you are using isset(), empty() would do a better job.
And when you are dealing with arrays what you probably want to use instead of isset() is
array_key_exists()
These days, I almost never use isset() and I write a lot of code.
----
Server IP: 69.147.83.197
Probable Submitter: 75.165.42.51
----
Manual Page -- http://www.php.net/manual/en/function.isset.php
Edit -- https://master.php.net/note/edit/77076
Del: integrated -- https://master.php.net/note/delete/77076/integrated
Del: useless -- https://master.php.net/note/delete/77076/useless
Del: bad code -- https://master.php.net/note/delete/77076/bad+code
Del: spam -- https://master.php.net/note/delete/77076/spam
Del: non-english -- https://master.php.net/note/delete/77076/non-english
Del: in docs -- https://master.php.net/note/delete/77076/in+docs
Del: other reasons-- https://master.php.net/note/delete/77076
Reject -- https://master.php.net/note/reject/77076
Search -- https://master.php.net/manage/user-notes.php