Hi Devin,
The result you got is 'cas of the data type.You are not setting any values to 'zero','one','three','four' so,they will be treated as values and keys will be 0,1,2,3
and if you convert the string to INT the value is ZERO.
Convert the Key value to String before comparing you will get the result
i.e $key = (string) $key;
Cheers
Ajay