summaryrefslogtreecommitdiff
path: root/Zend/zend_operators.c
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2004-09-11 14:22:35 +0000
committerDerick Rethans <derick@php.net>2004-09-11 14:22:35 +0000
commit4bae5cb4d051b50d8c1ffac90affca36a8429f6b (patch)
tree148a00eff682ab89f208b5057ddf54350d8138de /Zend/zend_operators.c
parentb3a32e6d2165a9a97681ea0c57fcb986091e79cf (diff)
downloadphp-git-4bae5cb4d051b50d8c1ffac90affca36a8429f6b.tar.gz
- MFB: Added the sorting flag SORT_LOCALE_STRING to the sort() functions which
makes them sort based on the current locale. (Derick)
Diffstat (limited to 'Zend/zend_operators.c')
-rw-r--r--Zend/zend_operators.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c
index 446c62bbc3..8038d457f2 100644
--- a/Zend/zend_operators.c
+++ b/Zend/zend_operators.c
@@ -1222,6 +1222,35 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_D
return SUCCESS;
}
+#if HAVE_STRCOLL
+ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
+{
+ zval op1_copy, op2_copy;
+ int use_copy1, use_copy2;
+
+ zend_make_printable_zval(op1, &op1_copy, &use_copy1);
+ zend_make_printable_zval(op2, &op2_copy, &use_copy2);
+
+ if (use_copy1) {
+ op1 = &op1_copy;
+ }
+ if (use_copy2) {
+ op2 = &op2_copy;
+ }
+
+ result->value.lval = strcoll(op1->value.str.val, op2->value.str.val);
+ result->type = IS_LONG;
+
+ if (use_copy1) {
+ zval_dtor(op1);
+ }
+ if (use_copy2) {
+ zval_dtor(op2);
+ }
+ return SUCCESS;
+}
+#endif
+
ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
zval op1_copy, op2_copy;