mirror of
https://github.com/php/doc-es.git
synced 2026-03-24 23:42:11 +01:00
158 lines
3.8 KiB
XML
158 lines
3.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 52e3799c4caf4a0448eea45b97c4d76a2d59c95d Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="arrayobject.natsort" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>ArrayObject::natsort</refname>
|
|
<refpurpose>Ordena los elementos con un tri natural</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis role="ArrayObject">
|
|
<modifier>public</modifier> <type>true</type><methodname>ArrayObject::natsort</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Este método implementa un algoritmo de ordenación que coloca las
|
|
strings alfanuméricas en el mismo orden que un humano utilizaría,
|
|
manteniendo la correlación entre las claves y los valores. Esto se
|
|
denomina tri natural. Por ejemplo, el tri natural se distingue del
|
|
tri informático, tal como se utiliza en
|
|
<link linkend="arrayobject.asort">ArrayObject::asort</link>, como
|
|
se ilustra a continuación.
|
|
</para>
|
|
¬e.sort-unstable;
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
&no.function.parameters;
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.void;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&return.type.true;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo con <function>ArrayObject::natsort</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array = array("img12.png", "img10.png", "img2.png", "img1.png");
|
|
|
|
$arr1 = new ArrayObject($array);
|
|
$arr2 = clone $arr1;
|
|
|
|
$arr1->asort();
|
|
echo "Tri estándar\n";
|
|
var_dump($arr1);
|
|
|
|
$arr2->natsort();
|
|
echo "\nTri en orden natural\n";
|
|
var_dump($arr2);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Tri estándar
|
|
object(ArrayObject)#1 (1) {
|
|
["storage":"ArrayObject":private]=>
|
|
array(4) {
|
|
[3]=>
|
|
string(8) "img1.png"
|
|
[1]=>
|
|
string(9) "img10.png"
|
|
[0]=>
|
|
string(9) "img12.png"
|
|
[2]=>
|
|
string(8) "img2.png"
|
|
}
|
|
}
|
|
|
|
Tri en orden natural
|
|
object(ArrayObject)#2 (1) {
|
|
["storage":"ArrayObject":private]=>
|
|
array(4) {
|
|
[3]=>
|
|
string(8) "img1.png"
|
|
[2]=>
|
|
string(8) "img2.png"
|
|
[1]=>
|
|
string(9) "img10.png"
|
|
[0]=>
|
|
string(9) "img12.png"
|
|
}
|
|
}
|
|
]]>
|
|
</screen>
|
|
<para>
|
|
Para más información, véase el sitio de Martin Pool
|
|
<link xlink:href="&url.strnatcmp;"><literal>Natural Order String Comparison</literal></link>.
|
|
</para>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>ArrayObject::asort</methodname></member>
|
|
<member><methodname>ArrayObject::ksort</methodname></member>
|
|
<member><methodname>ArrayObject::natcasesort</methodname></member>
|
|
<member><methodname>ArrayObject::uasort</methodname></member>
|
|
<member><methodname>ArrayObject::uksort</methodname></member>
|
|
<member><function>natsort</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
|
|
-->
|