在
PHP中我有两个对象,它们是不同的,因为$_frets变量(x是一个字符串“x”),但PHP说
($o1 == $o2) == TRUE.
为什么?
$o1的转储:
guitarChord Object
(
[_guitarChord:guitarChord:private] =>
[_chord:guitarChord:private] => chord Object()
[_baseFret:guitarChord:private] => 0
[_frets:guitarChord:private] => Array
(
[0] => x
[1] => 0
[2] => 2
[3] => 2
[4] => 2
[5] => x
)
[_tuning:guitarChord:private] => tuning Object()
[currVariation] => 0
[nextVariation] =>
[prevVariation] =>
)
$o2的转储:
guitarChord Object
(
[_guitarChord:guitarChord:private] =>
[_chord:guitarChord:private] => chord Object()
[_baseFret:guitarChord:private] => 0
[_frets:guitarChord:private] => Array
(
[0] => x
[1] => 0
[2] => 2
[3] => 2
[4] => 2
[5] => 0
)
[_tuning:guitarChord:private] => tuning Object()
[currVariation] => 0
[nextVariation] =>
[prevVariation] =>
)
编辑:
所以原因是因为(“x”== 0)= TRUE.谁能告诉我为什么?