sort giving strange results

Posted by Jay on Stack Overflow See other posts from Stack Overflow or by Jay
Published on 2012-11-03T22:22:22Z Indexed on 2012/11/03 23:00 UTC
Read the original article Hit count: 221

Filed under:

I have an array of email addresses that I am trying to sort, but I'm getting odd results. Here is what I mean:

sort($array);
print_r($array);
...[79] => 91******@******.com [80] => 9l***@**********.com 
[81] => ps*******@**********.com [82] => a.c******@*****.com 
[83] => a.d****@*****.com...

What would cause that email beginning with p's to be mixed in after the numbers and before the A's?

I removed that email address from the database and replaced it with "testing" and then "testing" appeared in the same position.

© Stack Overflow or respective owner

Related posts about php