Collator::getSortKey
collator_get_sort_key
(PHP 5 >= 5.3.11, PECL intl >= 1.0.3)
Collator::getSortKey -- collator_get_sort_key — Get sorting key for a string
Beschreibung
Objektorientierter Stil
public
string
Collator::getSortKey
( string
$str
)Prozeduraler Stil
Return collation key for a string.
Rückgabewerte
Returns the collation key for the string. Collation keys can be compared directly instead of strings.
Warnung
Diese Funktion kann sowohl das
boolsche FALSE zurückliefern, als auch einen nicht-boolschen Wert, welcher zu FALSE ausgewertet wird.
Weitere Informationen entnehmen Sie bitte dem Abschnitt über die
boolschen Typen. Benutzen Sie deshalb
den === Operator,
um den Rückgabewert dieser Funktion zu überprüfen.
Beispiele
Beispiel #1 collator_get_sort_key()example
<?php
$s1 = 'Hello';
$coll = collator_create( 'en_US' );
$res = collator_get_sort_key( $coll, $s1);
echo urlencode($res);
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
71%3F%3FE%01%09%01%8F%08%00
Siehe auch
- collator_sort() - Sort array using specified collator
- collator_sort_with_sort_keys() - Sort array using specified collator and sort keys