php-doc-en/reference/intl/collator/get-sort-key.xml
2021-04-22 17:52:58 +03:00

119 lines
3.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="collator.getsortkey" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>Collator::getSortKey</refname>
<refname>collator_get_sort_key</refname>
<refpurpose>Get sorting key for a string</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
&style.oop;
</para>
<methodsynopsis role="oop">
<modifier>public</modifier> <type class="union"><type>string</type><type>false</type></type><methodname>Collator::getSortKey</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
&style.procedural;
</para>
<methodsynopsis role="procedural">
<type class="union"><type>string</type><type>false</type></type><methodname>collator_get_sort_key</methodname>
<methodparam><type>Collator</type><parameter>object</parameter></methodparam>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
</methodsynopsis>
<para>
Return collation key for a string.
Collation keys can be compared directly instead of strings, though are implementation
specific and may change between ICU library versions. Sort keys are generally only
useful in databases or other circumstances where function calls are extremely expensive.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>object</parameter></term>
<listitem>
<para>
<classname>Collator</classname> object.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>string</parameter></term>
<listitem>
<para>
The string to produce the key from.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>Returns the collation key for the string, &return.falseforfailure;.</para>
&return.falseproblem;
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>collator_get_sort_key</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$s1 = 'Hello';
$coll = collator_create('en_US');
$res = collator_get_sort_key($coll, $s1);
echo bin2hex($res);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
3832404046010901dc08
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>collator_sort</function></member>
<member><function>collator_sort_with_sort_keys</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->