Files
doc-fr/reference/array/functions/in-array.xml
Damien Seguy e39cd06695 true/false turned into entities
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@91900 c90b9560-bf6c-de11-be94-00142212c4b1
2002-08-14 02:19:36 +00:00

98 lines
2.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- splitted from ./fr/functions/array.xml, last change in rev 1.30 -->
<!-- last change to 'in-array' in en/ tree in rev 1.56 -->
<refentry id="function.in-array">
<refnamediv>
<refname>in_array</refname>
<refpurpose>
Indique si une valeur appartient &agrave; un tableau
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>boolean</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>boolean</type><parameter>strict</parameter></methodparam>
</methodsynopsis>
<para>
<function>in_array</function> recherche <parameter>needle</parameter> dans
<parameter>haystack</parameter> et retourne &true;
s'il s'y trouve, ou &false; sinon.
</para>
<para>
Le troisi&egrave;me param&egrave;tre <parameter>strict</parameter> est
optionnel. S'il vaut &true; alors <function>in_array</function>
v&eacute;rifiera aussi que le types du param&egrave;tre <parameter>needle</parameter>
correspond &agrave; la valeur trouv&eacute;e dans <parameter>haystack</parameter>.
</para>
<para>
<example>
<title>Exemple avec <function>in_array</function></title>
<programlisting role="php">
&lt;?php
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os))
print "Irix trouve";
?&gt;
</programlisting>
</example>
</para>
<para>
<example>
<title>
<function>in_array</function> avec le param&egrave;tre <parameter>strict</parameter>
</title>
<programlisting role="php">
&lt;?php
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, &true;))
echo &quot;'12.4' trouv&eacute; avec une recherche stricte\n&quot;;
if (in_array(1.13, $a, &true;))
echo &quot;1.13 trouv&eacute; avec une recherche stricte\n&quot;;
?&gt;
</programlisting>
</example>
</para>
<para>
L'affichage sera :
</para>
<informalexample>
<screen>
1.13 trouv&eacute; avec une recherche stricte
</screen>
</informalexample>
<note>
<para>
<function>in_array</function> a &eacute;t&eacute; ajout&eacute;e en PHP 4.0.
</para>
</note>
<para>
Voir aussi
<function>array_search</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
-->