svn: /phpdoc/es/trunk/reference/array/functions/ in-array.xml

From: Date: Fri, 02 Apr 2010 14:58:24 +0000
Subject: svn: /phpdoc/es/trunk/reference/array/functions/ in-array.xml
Groups: php.doc.es 
Request: Send a blank email to doc-es+get-2284@lists.php.net to get a copy of this message
yago Fri, 02 Apr 2010 14:58:24 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=297337 Log: Fichero traducido. Changed paths: A phpdoc/es/trunk/reference/array/functions/in-array.xml Added: phpdoc/es/trunk/reference/array/functions/in-array.xml =================================================================== --- phpdoc/es/trunk/reference/array/functions/in-array.xml (rev 0) +++ phpdoc/es/trunk/reference/array/functions/in-array.xml 2010-04-02 14:58:24 UTC (rev 297337) @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision$ --> +<!-- EN-Revision: 297028 Maintainer: yago Status: ready --> +<refentry xml:id="function.in-array" xmlns="http://docbook.org/ns/docbook"> + <refnamediv> + <refname>in_array</refname> + <refpurpose>Comprueba si un valor existe en un array</refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>bool</type><methodname>in_array</methodname> + <methodparam><type>mixed</type><parameter>needle</parameter></methodparam> + <methodparam><type>array</type><parameter>haystack</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam> + </methodsynopsis> + <para> + Busca la <parameter>needle</parameter> (aguja) en el <parameter>haystack</parameter> (pajar). + </para> + </refsect1> + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>needle</parameter></term> + <listitem> + <para> + El valor a buscar. + </para> + <note> + <para> + Si la <parameter>needle</parameter> es una cadena, la comparación se realiza + en modo sensible a mayúsculas. + </para> + </note> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>haystack</parameter></term> + <listitem> + <para> + El array. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>strict</parameter></term> + <listitem> + <para> + Si se define a &true; el tercer parámetro <parameter>strict</parameter> + la función <function>in_array</function> también comprobará los + <link linkend="language.types">tipos</link> de la + <parameter>needle</parameter> en el <parameter>haystack</parameter>. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + Devuelve &true; si la <parameter>needle</parameter> se encuentra en el array, + &false; de lo contrario. + </para> + </refsect1> + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>4.2.0</entry> + <entry> + <parameter>needle</parameter> quizá no es un array. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Ejemplo de <function>in_array</function></title> + <programlisting role="php"> +<![CDATA[ +<?php +$os = array("Mac", "NT", "Irix", "Linux"); +if (in_array("Irix", $os)) { + echo "Got Irix"; +} +if (in_array("mac", $os)) { + echo "Got mac"; +} +?> +]]> + </programlisting> + <para> + La segunda condición falla porque <function>in_array</function> + es sensible a mayúsculas, así que el programa + The second condition fails because <function>in_array</function> + is case-sensitive, so the program anterior mostrará: + </para> + <screen> +<![CDATA[ +Got Irix +]]> + </screen> + </example> + </para> + <para> + <example> + <title>Ejemplo de <function>in_array</function> en modo estricto</title> + <programlisting role="php"> +<![CDATA[ +<?php +$a = array('1.10', 12.4, 1.13); + +if (in_array('12.4', $a, true)) { + echo "'12.4' found with strict check\n"; +} + +if (in_array(1.13, $a, true)) { + echo "1.13 found with strict check\n"; +} +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +1.13 found with strict check +]]> + </screen> + </example> + </para> + <para> + <example> + <title><function>in_array</function> con un array como aguja</title> + <programlisting role="php"> +<![CDATA[ +<?php +$a = array(array('p', 'h'), array('p', 'r'), 'o'); + +if (in_array(array('p', 'h'), $a)) { + echo "'ph' was found\n"; +} + +if (in_array(array('f', 'i'), $a)) { + echo "'fi' was found\n"; +} + +if (in_array('o', $a)) { + echo "'o' was found\n"; +} +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ + 'ph' was found + 'o' was found +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>array_search</function></member> + <member><function>isset</function></member> + <member><function>array_key_exists</function></member> + </simplelist> + </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:"~/.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 +--> Property changes on: phpdoc/es/trunk/reference/array/functions/in-array.xml ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL Added: svn:eol-style + native

« previous php.doc.es (#2284) next »