mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Added string comparison function strcoll(). It uses the current locale to
do the comparisons. @- Added localeconv() and strcoll() functions for localization. (Sean)
This commit is contained in:
parent
b8b40f697e
commit
a588d65591
3 changed files with 27 additions and 1 deletions
|
@ -162,6 +162,11 @@ function_entry basic_functions[] = {
|
||||||
PHP_FE(strstr, NULL)
|
PHP_FE(strstr, NULL)
|
||||||
PHP_FE(stristr, NULL)
|
PHP_FE(stristr, NULL)
|
||||||
PHP_FE(strrchr, NULL)
|
PHP_FE(strrchr, NULL)
|
||||||
|
#ifdef HAVE_STRCOLL
|
||||||
|
PHP_FE(strcoll, NULL)
|
||||||
|
#else
|
||||||
|
PHP_FALIAS(strcoll, warn_not_available, NULL)
|
||||||
|
#endif
|
||||||
PHP_FE(substr, NULL)
|
PHP_FE(substr, NULL)
|
||||||
PHP_FE(substr_replace, NULL)
|
PHP_FE(substr_replace, NULL)
|
||||||
PHP_FE(quotemeta, NULL)
|
PHP_FE(quotemeta, NULL)
|
||||||
|
|
|
@ -79,9 +79,12 @@ PHP_FUNCTION(strnatcasecmp);
|
||||||
PHP_FUNCTION(substr_count);
|
PHP_FUNCTION(substr_count);
|
||||||
PHP_FUNCTION(str_pad);
|
PHP_FUNCTION(str_pad);
|
||||||
PHP_FUNCTION(sscanf);
|
PHP_FUNCTION(sscanf);
|
||||||
|
#ifdef HAVE_STRCOLL
|
||||||
|
PHP_FUNCTION(strcoll);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_LOCALECONV) && defined(ZTS)
|
#ifdef ZTS
|
||||||
PHP_MINIT_FUNCTION(localeconv);
|
PHP_MINIT_FUNCTION(localeconv);
|
||||||
PHP_MSHUTDOWN_FUNCTION(localeconv);
|
PHP_MSHUTDOWN_FUNCTION(localeconv);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -210,6 +210,24 @@ PHP_FUNCTION(strcspn)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
#ifdef HAVE_STRCOLL
|
||||||
|
/* {{{ proto int strcoll(string str1, string str2)
|
||||||
|
Compare two strings using the current locale */
|
||||||
|
PHP_FUNCTION(strcoll)
|
||||||
|
{
|
||||||
|
zval **s1, **s2;
|
||||||
|
|
||||||
|
if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &s1, &s2) == FAILURE) {
|
||||||
|
WRONG_PARAM_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
convert_to_string_ex(s1);
|
||||||
|
convert_to_string_ex(s2);
|
||||||
|
|
||||||
|
RETURN_LONG(strcoll((const char *)(*s1)->value.str.val, (const char *)(*s2)->value.str.val));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
PHPAPI void php_trim(zval *str, zval * return_value, int mode)
|
PHPAPI void php_trim(zval *str, zval * return_value, int mode)
|
||||||
/* mode 1 : trim left
|
/* mode 1 : trim left
|
||||||
mode 2 : trim right
|
mode 2 : trim right
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue