crazy things with PHP array
A very strange thing, I have an array where elem开发者_如何转开发ent 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!
There may be some trailing whitespace, to give one example, that gives no apparent difference. Try var_dump($array[7])
to see if that outputs the expected string(10) "[1000137d]"
.
Edit: wow I'm slow (in more ways than one ;)
精彩评论