我手上有一个真正的谜..
看下面的代码行..
if (in_array($_SESSION['enemies'][$i], $clones[$j]->defendAgainst)) {
..
}
其中 $_SESSION['enemies'][$i] 是这样的对象:
object(skinhead)#4 (16)
{
["weapon"]=> object(bowieknife)#5 (2)
{ ["name":protected]=> NULL ["damage":protected]=> NULL }
["name"]=> string(8) "skinhead"
["health"]=>string(3) "100"
["strength"]=> string(2) "10"
["luck"]=> string(1) "2"
["money"]=>string(1) "0"
["exp"]=> string(1) "0"
["rank"]=> string(2) "20"
["points"]=> string(1)"0"
["location_id"]=> NULL
["comboAttack"]=> int(2)
["attackValue"]=> int(15)
["attackType"]=> NULL
["attackMessage"]=> string(198) "Enemy #1 pulls off a 2-hit combo.Enemy #1 slashes at you with a bowie knife.You defend.You lose 8 health.Enemy #1 slashes at you with a bowie knife."
["target1"]=> NULL ["target2"]=> NULL }
并且 $clones[$j]->defendAgainst 是一个整数数组
现在 in_array 应该评估为 false,因为它正在 int 数组中搜索对象。但相反,它返回真!!!!怎么会这样?????