]> granicus.if.org Git - php/commitdiff
MFH: Added SORT_LOCALE_STRING for array sorting
authorfoobar <sniper@php.net>
Thu, 31 Mar 2005 08:18:40 +0000 (08:18 +0000)
committerfoobar <sniper@php.net>
Thu, 31 Mar 2005 08:18:40 +0000 (08:18 +0000)
NEWS
ext/standard/array.c

diff --git a/NEWS b/NEWS
index 3579fa0815845083df5f3b9158683b5e0b06cfb6..0a24a7ed26316bf60bfc9c2d3dce86b8105b7308 100644 (file)
--- 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()
index 21c7db4e6f6224a4e95bb506862c566e5e5707f1..3b06a10140ec88ccb6f144a70f1b4edc8e873450 100644 (file)
@@ -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;