crazy things with PHP array...

Posted by user296516 on Stack Overflow See other posts from Stack Overflow or by user296516
Published on 2010-05-25T18:59:05Z Indexed on 2010/05/25 19:11 UTC
Read the original article Hit count: 286

Filed under:

Hi, A very strange thing, I have an array where element 7 is '[1000137d]', but when I try to compare it by using if ( $array[7] == '[1000137d]' ) it will return a negative.

echo $array[7];
echo '<br>';
echo '[1000137d]';
echo '<br>';
echo md5($array[7]);
echo '<br>';
echo md5('[1000137d]');

this code would echo out:

[1000137d]
[1000137d]
ca9983334e720042e3a6cbb1dd6b7fd2
3b1c21e661bd7d38deda1f4a45eaa23b 

as you can see $array[7] is identical to [1000137d], yet their md5's differ. what do you think might be the problem?

Thanks!

© Stack Overflow or respective owner

Related posts about php