note 20524 deleted from function.isset by sniper
| From: | sniper@php.net | Date: | Mon, 06 Oct 2003 02:58:24 +0000 |
| Subject: | note 20524 deleted from function.isset by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57866@lists.php.net to get a copy of this message | ||
Note Submitter: lars.noschinski@gmx.de
----
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.';
}