note 20524 added to function.isset
| From: | lars dot noschinski at gmx dot de | Date: | Sat, 06 Apr 2002 16:29:37 +0000 |
| Subject: | note 20524 added to function.isset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28699@lists.php.net to get a copy of this message | ||
A behavior of isset where I doesn't know wheter it is a bug or not:
$string = "A test string.";
if (isset($string["index"])) {
echo 'Index "index" exists.';
}
This code prints 'Index "index" exists.'. It cost me some time, before I found
that out. For the desired behavior, the following code is correct:
$string = "A test string.";
if (is_array($sttring) && isset($string["index"])) {
echo 'Index "index" exists.';
}
--
http://www.php.net/manual/en/function.isset.php
http://master.php.net/manage/user-notes.php?action=edit+20524
http://master.php.net/manage/user-notes.php?action=delete+20524
http://master.php.net/manage/user-notes.php?action=reject+20524