note 89651 deleted from function.isset by googleguy
| From: | googleguy@php.net | Date: | Sat, 19 Jan 2013 03:54:22 +0000 |
| Subject: | note 89651 deleted from function.isset by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193266@lists.php.net to get a copy of this message | ||
Note Submitter: yarco dot w at gmail dot com
----
just following what edsko said, it is very amazing when you use isset to check a string. look at
what i found:
[yarco@localhost ~]$ php -a
Interactive shell
php > $abc = 'test';
php > print isset($abc['e']) ? 'yes' : 'no';
yes
php > print isset($abc['d']) ? 'yes' : 'no';
yes
php > print isset($abc['aaaaaaa']) ? 'yes' : 'no';
yes
php > print isset($abc[23]) ? 'yes' : 'no';
no
If you use string as index, isset would always return true.
(but i don't think it should return true)