mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08: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
|
@ -57,7 +57,16 @@ PHP_MINFO_FUNCTION(unicode);
|
|||
|
||||
PHP_FUNCTION(i18n_loc_get_default);
|
||||
PHP_FUNCTION(i18n_loc_set_default);
|
||||
PHP_FUNCTION(collator_create);
|
||||
PHP_FUNCTION(collator_compare);
|
||||
PHP_FUNCTION(collator_sort);
|
||||
PHP_FUNCTION(collator_set_strength);
|
||||
PHP_FUNCTION(collator_set_attribute);
|
||||
PHP_FUNCTION(collator_get_strength);
|
||||
PHP_FUNCTION(collator_get_attribute);
|
||||
PHP_METHOD(collator, __construct);
|
||||
|
||||
void php_init_collation(TSRMLS_D);
|
||||
extern php_stream_filter_factory php_unicode_filter_factory;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue