mirror of
https://github.com/php/doc-es.git
synced 2026-03-26 08:22:08 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@299291 c90b9560-bf6c-de11-be94-00142212c4b1
169 lines
4.9 KiB
XML
169 lines
4.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: yago Status: ready -->
|
|
<refentry xml:id="function.array-udiff" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>array_udiff</refname>
|
|
<refpurpose>Computa la diferencia entre arrays, usando una llamada de
|
|
retorno para la comparación de datos</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_udiff</methodname>
|
|
<methodparam><type>array</type><parameter>array1</parameter></methodparam>
|
|
<methodparam><type>array</type><parameter>array2</parameter></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter> ...</parameter></methodparam>
|
|
<methodparam><type>callback</type><parameter>data_compare_func</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Computa la diferencia de los arrays usando una función tipo llamada de
|
|
retorno para la comparación de datos. Esto difiere de
|
|
<function>array_diff</function>, la cual usa una función interna para la
|
|
comparación de datos.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>array1</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El primer array.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>array2</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El segundo array
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>data_compare_func</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La función llamada de retorno para la comparación.
|
|
</para>
|
|
<para>
|
|
La llamada de retorno especificada por el usuario es usada para la
|
|
comparación. Esta función debe devolver un entero menor que, igual, o
|
|
mayor que cero si el primer argumento es considerado como menor,
|
|
igual, o mayor que el segundo, respectivamente.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve un array que contiene todos los valores de <parameter>array1</parameter>
|
|
que no están presentes en ninguno de los otros argumentos.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>array_udiff</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
class cr {
|
|
private $miembro_privado;
|
|
function cr($val)
|
|
{
|
|
$this->miembro_privado = $val;
|
|
}
|
|
|
|
static function func_comp_cr($a, $b)
|
|
{
|
|
if ($a->miembro_privado === $b->miembro_privado) return 0;
|
|
return ($a->miembro_privado > $b->miembro_privado)? 1:-1;
|
|
}
|
|
}
|
|
$a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),);
|
|
$b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),);
|
|
|
|
$resultado = array_udiff($a, $b, array("cr", "func_comp_cr"));
|
|
print_r($resultado);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[0.5] => cr Object
|
|
(
|
|
[miembro_privado:private] => 12
|
|
)
|
|
|
|
[0] => cr Object
|
|
(
|
|
[miembro_privado:private] => 23
|
|
)
|
|
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<simpara>
|
|
Por favor note que esta función sólo analiza una dimensión de un array
|
|
n-dimensional. Por supuesto, puede analizar dimensiones más profundas
|
|
usando <literal>array_udiff($array1[0], $array2[0], "data_compare_func");</literal>.
|
|
</simpara>
|
|
</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_diff_uassoc</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:"~/.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
|
|
-->
|