mirror of
https://github.com/php/doc-pt_br.git
synced 2026-04-30 03:33:21 +02:00
838ad09c58
git-svn-id: https://svn.php.net/repository/phpdoc/pt_BR/trunk@78218 c90b9560-bf6c-de11-be94-00142212c4b1
105 lines
2.7 KiB
XML
105 lines
2.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- splitted from ./pt_BR/functions/array.xml, last change in rev 1.1 -->
|
|
<!-- last change to 'array-unique' in en/ tree in rev 1.2 -->
|
|
<refentry id="function.array-unique">
|
|
<refnamediv>
|
|
<refname>array_unique</refname>
|
|
<refpurpose>Remove o valores duplicados de um array</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descrição</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_unique</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_unique</function> recebe o argumento
|
|
<parameter>array</parameter> e retorna um novo array sem valores
|
|
duplicados.
|
|
</para>
|
|
<para>
|
|
Note que as chaves são preservadas. <function>array_unique</function> irá
|
|
manter a primeira chave encontrada para cada valor, e ignorar
|
|
as chaves posteriores.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Dois elementos são considerados iguais se, e somente se,
|
|
<literal>(string) $elem1 === (string) $elem2</literal>. Em palavras:
|
|
quando a represetação em string é a mesma.
|
|
<!-- TODO: example of it... -->
|
|
</simpara>
|
|
<simpara>
|
|
O primeiro será usado.
|
|
</simpara>
|
|
</note>
|
|
<warning>
|
|
<simpara>
|
|
Essa função não funcionava no PHP 4.0.4!
|
|
<!-- TODO: when exactly was this broken?... -->
|
|
</simpara>
|
|
</warning>
|
|
<para>
|
|
<example>
|
|
<title>Exemplo de <function>array_unique</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$input = array ("a" => "verde", "vermelho", "b" => "verde", "azul", "vermelho");
|
|
$result = array_unique ($input);
|
|
print_r($result);
|
|
// a saída será :
|
|
//Array
|
|
//(
|
|
// [a] => verde
|
|
// [0] => vermelho
|
|
// [1] => azul
|
|
//)
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_unique</function> e tipos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
$input = array (4,"4","3",4,3,"3");
|
|
$result = array_unique ($input);
|
|
var_dump($result);
|
|
|
|
/* saída:
|
|
array(2) {
|
|
[0]=>
|
|
int(4)
|
|
[1]=>
|
|
string(1) "3"
|
|
}
|
|
*/
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</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
|
|
-->
|