1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-24 15:32:36 +01:00
Files
archived-doc-es/reference/array/functions/array-udiff.xml
Leonardo Boshell b1c52084bb Actualizaciones
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@185418 c90b9560-bf6c-de11-be94-00142212c4b1
2005-04-29 04:29:25 +00:00

124 lines
3.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- EN-Revision: 1.10 Maintainer: lboshell Status: ready -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.14 -->
<refentry id="function.array-udiff">
<refnamediv>
<refname>array_udiff</refname>
<refpurpose>Computa la diferencia entre matrices, usando una
llamada de retorno para la comparaci&oacute;n de
datos</refpurpose>
</refnamediv>
<refsect1>
<title>Descripci&oacute;n</title>
<methodsynopsis>
<type>array</type><methodname>array_udiff</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_datos</parameter></methodparam>
</methodsynopsis>
<para>
<function>array_udiff</function> devuelve una matriz que contiene
todos los valores de <parameter>matriz1</parameter> que no
est&aacute;n presentes en ninguno de los otros argumentos. Note
que las claves son preservadas. Para la comparaci&oacute;n de
datos, se usa <parameter>func_comparacion_datos</parameter>. Esta
funci&oacute;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. Esto en contraste a
<function>array_diff</function>, la cual usa una funci&oacute;n
interna para la comparaci&oacute;n de datos.
</para>
<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;
}
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>
<note>
<simpara>
Por favor note que esta funci&oacute;n s&oacute;lo analiza una
dimensi&oacute;n de una matriz n-dimensional. Por supuesto,
puede analizar dimensiones m&aacute;s profundas usando
<literal>array_udiff($matriz1[0], $matriz2[0],
"data_compare_func");</literal>.
</simpara>
</note>
<para>
Vea tambi&eacute;n <function>array_diff</function>,
<function>array_diff_assoc</function>,
<function>array_diff_uassoc</function>,
<function>array_udiff_assoc</function>,
<function>array_udiff_uassoc</function>,
<function>array_intersect</function>,
<function>array_intersect_assoc</function>,
<function>array_uintersect</function>,
<function>array_uintersect_assoc</function> y
<function>array_uintersect_uassoc</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
-->