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
Descrição
Estilo orientado à objeto
public
string
Collator::getSortKey
( string
$str
)Estilo procedural
Return collation key for a string.
Valor Retornado
Returns the collation key for the string. Collation keys can be compared directly instead of strings.
Warning
Esta função pode
retornar o booleano FALSE, mas também pode retornar um valor não-booleano que pode ser
avaliado como FALSE, como 0 ou
"". Leia a seção em Booleanos para maiores
informações. Utilize o operador ===
para testar o valor retornado por esta
função.
Exemplos
Example #1 collator_get_sort_key()example
<?php
$s1 = 'Hello';
$coll = collator_create( 'en_US' );
$res = collator_get_sort_key( $coll, $s1);
echo urlencode($res);
?>
O exemplo acima irá imprimir:
71%3F%3FE%01%09%01%8F%08%00
Veja Também
- collator_sort() - Sort array using specified collator
- collator_sort_with_sort_keys() - Sort array using specified collator and sort keys