mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-27 02:12:19 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@91900 c90b9560-bf6c-de11-be94-00142212c4b1
98 lines
2.8 KiB
XML
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 à 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ème paramètre <parameter>strict</parameter> est
|
|
optionnel. S'il vaut &true; alors <function>in_array</function>
|
|
vérifiera aussi que le types du paramètre <parameter>needle</parameter>
|
|
correspond à la valeur trouvée dans <parameter>haystack</parameter>.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>in_array</function></title>
|
|
<programlisting role="php">
|
|
<?php
|
|
$os = array("Mac", "NT", "Irix", "Linux");
|
|
if (in_array("Irix", $os))
|
|
print "Irix trouve";
|
|
?>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>
|
|
<function>in_array</function> avec le paramètre <parameter>strict</parameter>
|
|
</title>
|
|
<programlisting role="php">
|
|
<?php
|
|
$a = array('1.10', 12.4, 1.13);
|
|
if (in_array('12.4', $a, &true;))
|
|
echo "'12.4' trouvé avec une recherche stricte\n";
|
|
if (in_array(1.13, $a, &true;))
|
|
echo "1.13 trouvé avec une recherche stricte\n";
|
|
?>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
L'affichage sera :
|
|
</para>
|
|
<informalexample>
|
|
<screen>
|
|
1.13 trouvé avec une recherche stricte
|
|
</screen>
|
|
</informalexample>
|
|
<note>
|
|
<para>
|
|
<function>in_array</function> a été ajouté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
|
|
-->
|