Isset ($string["toto"])返回false或true PHP版本函数


isset($string["toto"]) returns false or true function of php version

在我的客户公司,我发现一段代码非常奇怪…我不明白开发者想要做什么。我不懂PHP的逻辑。

var_dump($string["toto"]);
if(isset($string["toto"])) {
  return TRUE;
}
else{
  return FALSE;
}

$string是一个字符串,如"house"。Var_dump ($string["toto"])返回h,因为toto不是整数,所以它被认为是0,所以它返回house的第一个字母。

,

在PHP 5.3中,isset($string["toto"])返回true

在PHP 5.5中,isset($string["toto"])返回false

有人知道为什么吗?PHP 5.4或PHP 5.5中关于字符串用作字符数组的更改?

谢谢:)

请RTM:

5.4.0检查字符串的非数字偏移量现在返回FALSE

。,尝试以字符串索引开头访问字符串偏移量是错误的。