Derick, i know this is the initial dump, but have a look also here : http://icu.sourceforge.net/userguide/Collate_ServiceArchitecture.html#Sort_Key
For small lists the current implementation is OK, but after a threshold, sort keys are better performance-wise. Here's an implementation of mine (untested, unfortunately) which attempts to use sort-keys as well as accomodating iterators (search for "sort"). Never mind the use of the C++ API, the concept is the same. http://cvs.iworks.at/co.php/php-i18n/collator.cpp?r=1.3 I actually have a different implementation (strictly C) which switches between ucol_compare and sort-key generation after a threshold, but i havent had time to work on it. l0t3k ""Derick Rethans"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > derick Sun Mar 26 11:06:24 2006 UTC > > Added files: > /php-src/ext/unicode collator.c > > Modified files: > /php-src/ext/standard array.c php_array.h > /php-src/ext/unicode config.m4 config.w32 php_unicode.h unicode.c > Log: > - 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ÃYe', > 'flüÃYe', > ); > > echo "German phonebook:\n"; > $c = collator_create( "[EMAIL PROTECTED]" ); > 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"; > ?> > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php