1
0
mirror of https://github.com/php/doc-it.git synced 2026-03-25 16:12:17 +01:00
Files
Richard Quadling 2769b12f1b Reencode XML to UTF-8
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@314558 c90b9560-bf6c-de11-be94-00142212c4b1
2011-08-08 16:37:53 +00:00

109 lines
3.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: n/a Maintainer: darvina Status: ready -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.38 -->
<refentry xml:id="function.strnatcmp" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>strnatcmp</refname>
<refpurpose>
Confronto tra stringhe con l'algoritmo dell' "ordine naturale"
</refpurpose>
</refnamediv>
<refsect1>
<title>Descrizione</title>
<methodsynopsis>
<type>int</type><methodname>strnatcmp</methodname>
<methodparam><type>string</type><parameter>str1</parameter></methodparam>
<methodparam><type>string</type><parameter>str2</parameter></methodparam>
</methodsynopsis>
<para>
Questa funzione implementa un algoritmo di confronto che ordina
le stringhe alfa-numeriche nel modo con cui lo avrebbe fatto un uomo,
questo è detto "ordinamento naturale". Un esempio della differenza tra
questo algoritmo e quello solito dei computer
(utilizzato da <function>strcmp</function>) è illustrato
di seguito:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$arr1 = $arr2 = array("img12.png", "img10.png", "img2.png", "img1.png");
echo "Standard string comparison\n";
usort($arr1, "strcmp");
print_r($arr1);
echo "\nNatural order string comparison\n";
usort($arr2, "strnatcmp");
print_r($arr2);
?>
]]>
</programlisting>
</informalexample>
Il precedente codice visualizzerà:
<informalexample>
<screen>
<![CDATA[
Standard string comparison
Array
(
[0] => img1.png
[1] => img10.png
[2] => img12.png
[3] => img2.png
)
Natural order string comparison
Array
(
[0] => img1.png
[1] => img2.png
[2] => img10.png
[3] => img12.png
)
]]>
</screen>
</informalexample>
Per maggiori informazioni vedere: Martin Pool's <link
xlink:href="&url.strnatcmp;">Natural Order String Comparison</link>
page.
</para>
<simpara>
Al pari delle altre funzioni di confronto tra stringhe, questa restituisce
&lt; 0 se <parameter>str1</parameter> è minore di
<parameter>str2</parameter>; &gt; 0 se
<parameter>str1</parameter> è maggiore di
<parameter>str2</parameter>, e 0 se sono uguali.
</simpara>
<simpara>
Nota questo confronto distingue tra lettere maiuscole e minuscole.
</simpara>
<simpara>
Vedere anche <function>ereg</function>,
<function>strcasecmp</function>, <function>substr</function>,
<function>stristr</function>, <function>strcmp</function>,
<function>strncmp</function>, <function>strncasecmp</function>,
<function>strnatcasecmp</function>, <function>strstr</function>,
<function>natsort</function> e <function>natcasesort</function>.
</simpara>
</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
-->