ID:          37480
 Updated by:  [EMAIL PROTECTED]
 Reported By: 8umucsxy at terra dot es
-Status:      Open
+Status:      Bogus
 Bug Type:    Feature/Change Request
 PHP Version: 4.4.2
 New Comment:

How can you have a feature request with reproducable code? And this is
all already very possible:

<?php
setlocale(LC_ALL, 'es_ES');

$words = array( ABADIA, ALVAREZ, BUÑUEL, ZUBIETA, ÁLVARES );

sort( $words, SORT_LOCALE_STRING);
var_dump($words);
?>

outputs:
array(5) {
  [0]=>
  string(6) "ABADIA"
  [1]=>
  string(7) "ÁLVARES"
  [2]=>
  string(7) "ALVAREZ"
  [3]=>
  string(6) "BUÑUEL"
  [4]=>
  string(7) "ZUBIETA"
}



Previous Comments:
------------------------------------------------------------------------

[2006-05-17 16:57:21] 8umucsxy at terra dot es

Description:
------------
There is a problem with array_multisort in languages other than
English.
For special chars, as A with accent (Á), the sorting does not
correspond to what might expect from a MySQL SELECT with ORDER BY.
 
For example the code attached to the message
  
will sort the array in this way: ABADIA, ALVAREZ, BUÑUEL, ZUBIETA,
ÁLVARES
 
while a MySQL SELECT with ORDER BY nombre ASC will yield
 
ABADIA, ÁLVARES, ALVEREZ, BUÑUEL, ZUBIETA
 
as A and Á are considered two different representations of the same
letter.


Reproduce code:
---------------
 foreach ($students as $key => $row){
          $surname[$key] = $row['surname'];
       }
       array_multisort($surname, SORT_ASC, $students);


Expected result:
----------------
ABADIA, ÁLVARES, ALVEREZ, BUÑUEL, ZUBIETA

Actual result:
--------------
ABADIA, ALVAREZ, BUÑUEL, ZUBIETA, ÁLVARES


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37480&edit=1

Reply via email to