[eluser]mddd[/eluser]
If a comparison involves a number, the other item is also converted to a number.
So php converts 'text' to a number and then compares the two.
'text' converted to a number equals 0 because it doesn't start with a digit.
So $key == 'text' becomes 0 == 0 and that's true.
Bottom line: if you want to compare something to a text, make sure it is not a number..
$key = ''; or $key = false; would probably both have worked like you expect.