mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-24 07:02:09 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/pt_BR/trunk@136096 c90b9560-bf6c-de11-be94-00142212c4b1
90 lines
2.9 KiB
XML
90 lines
2.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- EN-Revision: 1.9 Maintainer: lucasr Status: ready -->
|
|
<!-- splitted from ./pt_BR/functions/array.xml, last change in rev 1.3 -->
|
|
<!-- last change to 'array-diff' in en/ tree in rev 1.14 -->
|
|
<refentry id="function.array-diff">
|
|
<refnamediv>
|
|
<refname>array_diff</refname>
|
|
<refpurpose>Analisa as diferenças entre arrays</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrição</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_diff</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>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_diff</function> retorna um array contendo todos os
|
|
valores de <parameter>array1</parameter> que não estão presentes
|
|
em nenhum dos outros argumentos. Note que as chaves são preservadas.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Exemplo de <function>array_diff</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array1 = array ("a" => "verde", "vermelho", "azul", "vermelho");
|
|
$array2 = array ("b" => "verde", "amarelo", "vermelho");
|
|
$result = array_diff ($array1, $array2);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
O exemplo acima faz com que <varname>$result</varname> seja
|
|
<literal>array ("azul");</literal>. Ocorrências multiplas em
|
|
<parameter>$array1</parameter> são tratados da mesma forma.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Dois elementos são considerados iguais se, e somente se,
|
|
<literal>(string) $elem1 === (string) $elem2</literal>. Em palavras:
|
|
quando a representação em string é a mesma.
|
|
<!-- TODO: example of it... -->
|
|
</simpara>
|
|
</note>
|
|
<note>
|
|
<simpara>
|
|
Note que esta função faz compara apenas uma dimensão de um array com
|
|
dimensão n. Mas, obviamente, você pode comparar outras dimensões usando
|
|
<literal>array_diff($array1[0], $array2[0]);</literal>.
|
|
</simpara>
|
|
</note>
|
|
<warning>
|
|
<simpara>
|
|
Não estava funcionando no PHP 4.0.4!
|
|
<!-- TODO: when exactly was this broken?... -->
|
|
</simpara>
|
|
</warning>
|
|
<para>
|
|
Veja também <function>array_diff_assoc</function>, <function>array_intersect</function>
|
|
e <function>array_intersect_assoc</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
|
|
-->
|