1
0
mirror of https://github.com/php/doc-es.git synced 2026-04-27 17:14:09 +02:00
Files
archived-doc-es/reference/array/functions/uksort.xml
T
Enrique Garcia Briones 98ecf196ef sync con version inglesa
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@172709 c90b9560-bf6c-de11-be94-00142212c4b1
2004-11-15 18:02:13 +00:00

104 lines
2.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- EN-Revision: 1.15 Maintainer: baoengb Status: ready -->
<!-- splitted from ./es/functions/array.xml, last change in rev 1.1 -->
<refentry id="function.uksort">
<refnamediv>
<refname>uksort</refname>
<refpurpose>
Ordena una matriz por claves mediante una funci&oacute;n definida por el usuario
</refpurpose>
</refnamediv>
<refsect1>
<title>Descripci&oacute;n</title>
<methodsynopsis>
<type>void</type><methodname>uksort</methodname>
<methodparam><type>array</type><parameter role="reference">matriz</parameter></methodparam>
<methodparam><type>function</type><parameter>func_comparar</parameter></methodparam>
</methodsynopsis>
<para>
Esta funci&oacute;n ordenar&aacute; las claves de una matriz utilizando una funci&oacute;n
de comparaci&oacute;n suministrada por el usuario. Si la matriz a ordenar
necesita utilizar un criterio poco trivial, esta es la funci&oacute;n que
deber&aacute; usar.
</para>
<para>
Function <parameter>cmp_function</parameter> should accept two
parameters which will be filled by pairs of <parameter>array</parameter> keys.
The comparison function must return an integer less than, equal
to, or greater than zero if the first argument is considered to
be respectively less than, equal to, or greater than the
second.
</para>
<para>
&return.success;
</para>
<para>
<example>
<title>Ejemplo de <function>uksort</function></title>
<programlisting role="php">
<![CDATA[
<?php
function cmp($a, $b)
{
if ($a == $b) {
return 0;
}
return ($a > $b) ? -1 : 1;
}
$a = array(4 => "four", 3 => "three", 20 => "twenty", 10 => "ten");
uksort($a, "cmp");
while (list($key, $value) = each($a)) {
echo "$key: $value\n";
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
20: twenty
10: ten
4: four
3: three
]]>
</screen>
</example>
</para>
<para>
Vea tambi&eacute;n: <function>usort</function>,
<function>uasort</function>,
<function>sort</function>,
<function>asort</function>,
<function>arsort</function>,
<function>ksort</function>,
<function>natsort</function>, y
<function>rsort</function>.
</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:"../../../../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
-->