mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
- Implemented basic collation support. For some reason "new Collator" gives segfaults when the object's collation resource is used.
- The following example shows what is implemented: <?php $orig = $strings = array( 'côte', 'cote', 'côté', 'coté', 'fluÃe', 'flüÃe', ); echo "German phonebook:\n"; $c = collator_create( "de@collation=phonebook" ); foreach($c->sort($strings) as $string) { echo $string, "\n"; } echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON ? "With" : "Without", " french accent sorting order\n"; echo "\nFrench with options:\n"; $c = collator_create( "fr" ); $c->setAttribute(Collator::CASE_FIRST, Collator::UPPER_FIRST); $c->setAttribute(Collator::CASE_LEVEL, Collator::ON); $c->setStrength(Collator::SECONDARY); foreach($c->sort($strings) as $string) { echo $string, "\n"; } echo $c->getAttribute(Collator::FRENCH_COLLATION) == Collator::ON ? "With" : "Without", " french accent sorting order\n"; ?>
This commit is contained in:
parent
150c896dae
commit
ad6a972de3
7 changed files with 338 additions and 35 deletions
|
@ -184,6 +184,8 @@ zend_function_entry unicode_functions[] = {
|
|||
PHP_FE(unicode_encode, NULL)
|
||||
PHP_FE(unicode_set_error_mode, NULL)
|
||||
PHP_FE(unicode_set_subst_char, NULL)
|
||||
PHP_FE(collator_create, NULL)
|
||||
PHP_FE(collator_compare, NULL)
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
/* }}} */
|
||||
|
@ -217,7 +219,8 @@ PHP_MINIT_FUNCTION(unicode)
|
|||
}
|
||||
|
||||
php_register_unicode_iterators(TSRMLS_C);
|
||||
|
||||
php_init_collation(TSRMLS_C);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue