note 99017 modified in function.uasort by danbrown

From: Date: Thu, 22 Jul 2010 14:42:06 +0000
Subject: note 99017 modified in function.uasort by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-171044@lists.php.net to get a copy of this message
To sort string containing Umlauts you can use this callback function: <?php function sortWUmlauts($s1, $s2) { $search = array('Ä','Ö','Ü','ß'); $replace = array('A','O','U','s'); return strcmp( str_ireplace($search, $replace, $s1), str_ireplace($search, $replace, $s2) ); } ?> simply call: <?php uasort($array, 'sortWUmlauts'); ?> --was-- To sort string containing Umlauts you can use this callback function: function sortWUmlauts($s1, $s2) { $search = array('Ä','Ö','Ü','ß'); $replace = array('A','O','U','s'); return strcmp( str_ireplace($search, $replace, $s1), str_ireplace($search, $replace, $s2) ); } simply call: uasort($array, 'sortWUmlauts'); http://php.net/manual/en/function.uasort.php

« previous php.notes (#171044) next »