mirror of
https://github.com/php/doc-es.git
synced 2026-04-23 07:08:17 +02:00
ce99262284
- All id attributes are now xml:id - Add docbook namespace to all root elements - Replace <ulink /> with <link xlink:href /> - Minor markup fixes here and there - Bump EN-Revision where appropriate git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@238324 c90b9560-bf6c-de11-be94-00142212c4b1
199 lines
5.5 KiB
XML
199 lines
5.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 1.9 $ -->
|
|
<!-- EN-Revision: 1.10 Maintainer: lboshell Status: ready -->
|
|
<refentry xml:id="function.array-diff-uassoc" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>array_diff_uassoc</refname>
|
|
<refpurpose>Computa la diferencia entre matrices con un chequeo adicional de
|
|
índices, el cual es realizado por una llamada de retorno entregada por el
|
|
usuario</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_diff_uassoc</methodname>
|
|
<methodparam><type>array</type><parameter>matriz1</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>matriz2</parameter></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam>
|
|
<methodparam><type>callback</type><parameter>func_comparacion_claves</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Compara <parameter>matriz1</parameter> contra
|
|
<parameter>matriz2</parameter> y devuelve la diferencia. En contraste con
|
|
<function>array_diff</function>, las claves de las matrices son usadas en
|
|
la comparación.
|
|
</para>
|
|
<para>
|
|
A diferencia de <function>array_diff_assoc</function>, una función de
|
|
llamada de retorno creada por el usuario es usada para la comparación de
|
|
índices, no una función interna.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
<term><parameter>matriz1</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La matriz a comparar
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><parameter>matriz2</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Una matriz contra la que se realiza la comparación
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><parameter>...</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Más matrices a incluir en la comparación
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
<term><parameter>func_comparacion_claves</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Función tipo <type>callback</type> a usar. La función de llamada de
|
|
retorno debe devolver un entero menor, igual o mayor a cero si el
|
|
primer argumento es considerado respectivamente como menor, igual o
|
|
mayor que el segundo.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve un valor tipo <type>array</type> que contiene todas las entradas
|
|
de <parameter>matriz1</parameter> que no están presentes en ninguna de
|
|
las otras matrices.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<!--
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
&errors.no.unusual.errors;
|
|
</refsect1>
|
|
-->
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>array_diff_uassoc</function></title>
|
|
<para>
|
|
La pareja <literal>"a" => "green"</literal> está presente en ambas
|
|
matrices y por lo tanto no es incluida en la salida de la función. En
|
|
contraste, la pareja <literal>0 => "red"</literal> está en la salida
|
|
porque en el segundo argumento <literal>"red"</literal> tiene una clave
|
|
que es <literal>1</literal>.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
function func_comparacion_claves($a, $b)
|
|
{
|
|
if ($a === $b) {
|
|
return 0;
|
|
}
|
|
return ($a > $b)? 1:-1;
|
|
}
|
|
|
|
$matriz1 = array("a" => "green", "b" => "brown", "c" => "blue", "red");
|
|
$matriz2 = array("a" => "green", "yellow", "red");
|
|
$resultado = array_diff_uassoc($matriz1, $matriz2, "func_comparacion_claves");
|
|
print_r($resultado);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[b] => brown
|
|
[c] => blue
|
|
[0] => red
|
|
)
|
|
]]>
|
|
</screen>
|
|
<simpara>
|
|
La igualdad de 2 índices es chequeada por la función de llamada de
|
|
retorno entregada por el usuario.
|
|
</simpara>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
Esta función sólo analiza una dimensión de una matriz n-dimensional. Por
|
|
supuesto que puede analizar dimensiones más profundas usando, por
|
|
ejemplo, <literal>array_diff_uassoc($matriz1[0], $matriz2[0],
|
|
"func_comparacion_claves");</literal>.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>array_diff</function></member>
|
|
<member><function>array_diff_assoc</function></member>
|
|
<member><function>array_udiff</function></member>
|
|
<member><function>array_udiff_assoc</function></member>
|
|
<member><function>array_udiff_uassoc</function></member>
|
|
<member><function>array_intersect</function></member>
|
|
<member><function>array_intersect_assoc</function></member>
|
|
<member><function>array_uintersect</function></member>
|
|
<member><function>array_uintersect_assoc</function></member>
|
|
<member><function>array_uintersect_uassoc</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:"../../../../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
|
|
-->
|