mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-24 07:02:09 +01:00
153 lines
4.4 KiB
XML
153 lines
4.4 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!-- EN-Revision: c84024092aee02b51dd18b909af0f2ccbdd24f98 Maintainer: lhsazevedo Status: ready --><!-- CREDITS: felipe, fabioluciano, matheusmmo, lhsazevedo -->
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.array-intersect-assoc">
|
|
<refnamediv>
|
|
<refname>array_intersect_assoc</refname>
|
|
<refpurpose>Computa a interseção de arrays com uma adicional verificação de índice</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_intersect_assoc</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
<methodparam rep="repeat"><type>array</type><parameter>arrays</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
<function>array_intersect_assoc</function> retorna um array
|
|
contendo todos os valores de <parameter>array</parameter>
|
|
que estão presentes em todos os argumentos. Note que estas chaves também são usadas na
|
|
comparação diferindo de <function>array_intersect</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>array</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
O array com os valores a serem verificados.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>arrays</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Arrays para comparar os valores.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retorna um array associativo contendo todos os valores em
|
|
<parameter>array</parameter> que estão presentes em todos os argumentos.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&array.changelog.require-only-one;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemplo da <function>array_intersect_assoc</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$array1 = array("a" => "verde", "b" => "marrom", "c" => "azul", "vermelho");
|
|
$array2 = array("a" => "verde", "b" => "amarelo", "azul", "vermelho");
|
|
$result_array = array_intersect_assoc($array1, $array2);
|
|
print_r($result_array);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[a] => verde
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<simpara>
|
|
Em nosso exemplo, é possível ver que somente o par <literal>"a" =>
|
|
"verde"</literal> está presente em ambos array, então logo é retornado.
|
|
O valor <literal>"vermelho"</literal> não é retornado porque no
|
|
<varname>$array1</varname> a chave é <literal>0</literal> quando
|
|
a chave de "vermelho" no <varname>$array2</varname> é
|
|
<literal>1</literal>, e a chave <literal>"b"</literal> não será retornada
|
|
por que seu valor é diferente em cada array.
|
|
</simpara>
|
|
<simpara>
|
|
Os dois valores dos pares <literal>key => value</literal> são
|
|
considerados iguais somente se
|
|
<literal>(string) $elem1 === (string) $elem2 </literal>. Em outras palavras,
|
|
uma verificação do tipo é executada, então a representação string precisa
|
|
ser a mesma.
|
|
<!-- TODO: example of it... -->
|
|
</simpara>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<simplelist>
|
|
<member><function>array_intersect</function></member>
|
|
<member><function>array_uintersect_assoc</function></member>
|
|
<member><function>array_intersect_uassoc</function></member>
|
|
<member><function>array_uintersect_uassoc</function></member>
|
|
<member><function>array_diff</function></member>
|
|
<member><function>array_diff_assoc</function></member>
|
|
</simplelist>
|
|
</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
|
|
-->
|