Return to locale_sort.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Sort with SORT_LOCALE_STRING 3: --SKIPIF-- 4: <?php 5: if (substr(PHP_OS, 0, 3) == 'WIN') { 6: die("skip Unix locale name only, not available on windows (and crashes with VC6)\n"); 7: } 8: if (false == setlocale(LC_CTYPE, "fr_FR", "fr_FR.ISO8859-1")) { 9: die("skip setlocale() failed\n"); 10: } 11: ?> 12: --INI-- 13: unicode.script_encoding=ISO8859-1 14: unicode.output_encoding=ISO8859-1 15: --FILE-- 16: <?php 17: setlocale(LC_ALL, 'fr_FR', 'fr_FR.ISO8859-1'); 18: $table = array("AB" => "Alberta", 19: "BC" => "Colombie-Britannique", 20: "MB" => "Manitoba", 21: "NB" => "Nouveau-Brunswick", 22: "NL" => "Terre-Neuve-et-Labrador", 23: "NS" => "Nouvelle-Écosse", 24: "ON" => "Ontario", 25: "PE" => "Île-du-Prince-Édouard", 26: "QC" => "Québec", 27: "SK" => "Saskatchewan", 28: "NT" => "Territoires du Nord-Ouest", 29: "NU" => "Nunavut", 30: "YT" => "Territoire du Yukon"); 31: asort($table, SORT_LOCALE_STRING); 32: var_dump($table); 33: ?> 34: --EXPECT-- 35: array(13) { 36: ["AB"]=> 37: string(7) "Alberta" 38: ["BC"]=> 39: string(20) "Colombie-Britannique" 40: ["PE"]=> 41: string(21) "Île-du-Prince-Édouard" 42: ["MB"]=> 43: string(8) "Manitoba" 44: ["NB"]=> 45: string(17) "Nouveau-Brunswick" 46: ["NS"]=> 47: string(15) "Nouvelle-Écosse" 48: ["NU"]=> 49: string(7) "Nunavut" 50: ["ON"]=> 51: string(7) "Ontario" 52: ["QC"]=> 53: string(6) "Québec" 54: ["SK"]=> 55: string(12) "Saskatchewan" 56: ["NL"]=> 57: string(23) "Terre-Neuve-et-Labrador" 58: ["YT"]=> 59: string(19) "Territoire du Yukon" 60: ["NT"]=> 61: string(25) "Territoires du Nord-Ouest" 62: }