|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-01-28 23:23 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 02 11:00:01 2025 UTC |
Description: ------------ If a variable is set to a string and isset() is used to check an array key for that variable it returns true. Reproduce code: --------------- $var="foo"; if(isset($var['ed'])) { //why are we in this section if $var is a string? if(is_array($var)) { // This doesn't happen echo "It's an array"; } else { // And yet this returns "f" echo $var['ed']; } } Expected result: ---------------- I would expect isset to return false; Actual result: -------------- isset returns true, because a check for any associative array index for the var will return the first character.