note 96196 added to function.isset
| From: | wes at arasian dot com | Date: | Sat, 13 Feb 2010 21:16:03 +0000 |
| Subject: | note 96196 added to function.isset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165938@lists.php.net to get a copy of this message | ||
"yarco" stated that:
<?php
$string = "test";
isset($string['aaaaa']);
?>
would return true, when it shouldn't.
Actually this is CORRECT behavior, because realize that 'aaaaa' evaluates as 0
numerically, and $string[0] is, indeed, set. To find whether a string exists within a string, use
strpos() instead.
----
Server IP: 192.41.40.227
Probable Submitter: 67.190.179.150
----
Manual Page -- http://www.php.net/manual/en/function.isset.php
Edit -- https://master.php.net/note/edit/96196
Del: integrated -- https://master.php.net/note/delete/96196/integrated
Del: useless -- https://master.php.net/note/delete/96196/useless
Del: bad code -- https://master.php.net/note/delete/96196/bad+code
Del: spam -- https://master.php.net/note/delete/96196/spam
Del: non-english -- https://master.php.net/note/delete/96196/non-english
Del: in docs -- https://master.php.net/note/delete/96196/in+docs
Del: other reasons-- https://master.php.net/note/delete/96196
Reject -- https://master.php.net/note/reject/96196
Search -- https://master.php.net/manage/user-notes.php