Why are these two objects equal (==)?

In PHP, I have two objects, they are different because of the variable $ _frets (x is the string "x"), but PHP says

($o1 == $o2) == TRUE. 

Why?

Dump $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] => ) 

Dump $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] => ) 

EDIT:

Therefore, the reason is that ("x" == 0) = TRUE . Can someone tell me why?

+7
source share

All Articles