Files
doc-fr/reference/array/functions/array-keys.xml
Jean-Sébastien Goupil dcbd76b0cc sync with EN
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@222717 c90b9560-bf6c-de11-be94-00142212c4b1
2006-11-03 12:03:58 +00:00

98 lines
2.4 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.17 $ -->
<!-- EN-Revision: 1.11 Maintainer: didou Status: ready -->
<!-- Reviewed: no -->
<refentry id="function.array-keys">
<refnamediv>
<refname>array_keys</refname>
<refpurpose>Retourne toutes les clés d'un tableau</refpurpose>
</refnamediv>
<refsect1>
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>array_keys</methodname>
<methodparam><type>array</type><parameter>input</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>search_value</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam>
</methodsynopsis>
<para>
<function>array_keys</function> retourne les clés numériques
et littérales du tableau <parameter>input</parameter>.
</para>
<para>
Si l'option <parameter>search_value</parameter> est spécifiée,
seules les clés ayant cette valeur seront retournées.
Sinon, toutes les clés de <parameter>input</parameter> sont
retournées.
Depuis &php; 5, vous pouvez utiliser le paramètre <parameter>strict</parameter>
pour une comparaison incluant le type (===).
</para>
<para>
<example>
<title>Exemple avec <function>array_keys</function></title>
<programlisting role="php">
<![CDATA[
<?php
$array = array (0 => 100, "couleur" => "rouge");
print_r(array_keys($array));
$array = array("bleu", "rouge", "vert", "bleu", "bleu");
print_r(array_keys($array, "bleu"));
$array = array("couleur" => array("bleu", "rouge", "vert"), "taille" => array("petit", "moyen", "grand"));
print_r(array_keys($array));
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[0] => 0
[1] => couleur
)
Array
(
[0] => 0
[1] => 3
[2] => 4
)
Array
(
[0] => couleur
[1] => taille
)
]]>
</screen>
</example>
</para>
<para>
Voir aussi
<function>array_values</function> et
<function>array_key_exists</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
-->