From: foobar Date: Thu, 31 Mar 2005 08:18:40 +0000 (+0000) Subject: MFH: Added SORT_LOCALE_STRING for array sorting X-Git-Tag: php-4.4.0RC1~170 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=70a222560d8ec5ef230ae21186787c6729f191c9;p=php MFH: Added SORT_LOCALE_STRING for array sorting --- diff --git a/NEWS b/NEWS index 3579fa0815..0a24a7ed26 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +?? ??? 20??, Version 4.?.? +- Added the sorting flag SORT_LOCALE_STRING to the sort() functions which makes + them sort based on the current locale. (Derick) + 31 Mar 2005, Version 4.3.11 - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony) - Added checks for negative values to gmp_sqrt(), gmp_powm(), gmp_sqrtrem() diff --git a/ext/standard/array.c b/ext/standard/array.c index 21c7db4e6f..3b06a10140 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -66,6 +66,7 @@ php_array_globals array_globals; #define SORT_REGULAR 0 #define SORT_NUMERIC 1 #define SORT_STRING 2 +#define SORT_LOCALE_STRING 5 #define SORT_DESC 3 #define SORT_ASC 4 @@ -103,6 +104,8 @@ PHP_MINIT_FUNCTION(array) REGISTER_LONG_CONSTANT("SORT_REGULAR", SORT_REGULAR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SORT_NUMERIC", SORT_NUMERIC, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("SORT_STRING", SORT_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("SORT_LOCALE_STRING", SORT_LOCALE_STRING, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CASE_LOWER", CASE_LOWER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CASE_UPPER", CASE_UPPER, CONST_CS | CONST_PERSISTENT); @@ -132,6 +135,12 @@ static void set_compare_func(int sort_type TSRMLS_DC) ARRAYG(compare_func) = string_compare_function; break; +#if HAVE_STRCOLL + case SORT_LOCALE_STRING: + ARRAYG(compare_func) = string_locale_compare_function; + break; +#endif + case SORT_REGULAR: default: ARRAYG(compare_func) = compare_function;