mirror of
https://github.com/php/doc-es.git
synced 2026-03-25 07:52:21 +01:00
- Nuevo documento del capitulo de seguridad (magicquotes.xml) git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@181350 c90b9560-bf6c-de11-be94-00142212c4b1
113 lines
2.9 KiB
XML
113 lines
2.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.5 $ -->
|
|
<!-- EN-Revision: 1.14 Maintainer: lboshell Status: ready -->
|
|
<!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
|
|
<refentry id="function.array-unique">
|
|
<refnamediv>
|
|
<refname>array_unique</refname>
|
|
<refpurpose>Remueve valores duplicados de una matriz</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Descripción</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_unique</methodname>
|
|
<methodparam><type>array</type><parameter>matriz</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_unique</function> toma la
|
|
<parameter>matriz</parameter> de entrada y devuelve una nueva
|
|
matriz sin los valores repetidos.
|
|
</para>
|
|
<para>
|
|
Note que las claves son
|
|
preservadas. <function>array_unique</function> ordena los valores
|
|
tratados como cadenas inicialmente, y luego conservará la
|
|
primera clave encontrada para cada valor, ignorando todas las
|
|
claves posteriores. No quiere decir esto que la clave del primer
|
|
valor relacionado de la <parameter>matriz</parameter> no-ordenada
|
|
se conservará.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Dos elementos son considerados equivalentes si y solo si
|
|
<literal>(string) $elem1 === (string) $elem2</literal>. En
|
|
palabras: cuando la representación tipo cadena es la
|
|
misma.
|
|
</simpara>
|
|
<simpara>
|
|
Se usará el primer elemento.
|
|
</simpara>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de <function>array_unique</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$entrada = array("a" => "verde", "rojo", "b" => "verde", "azul", "rojo");
|
|
$resultado = array_unique($entrada);
|
|
print_r($resultado);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen role="php">
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[a] => verde
|
|
[0] => rojo
|
|
[1] => azul
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_unique</function> y tipos de
|
|
datos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$entrada = array(4, "4", "3", 4, 3, "3");
|
|
$resultado = array_unique($entrada);
|
|
var_dump($resultado);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen role="php">
|
|
<![CDATA[
|
|
array(2) {
|
|
[0] => int(4)
|
|
[2] => string(1) "3"
|
|
}
|
|
]]>
|
|
</screen>
|
|
</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
|
|
-->
|