mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-26 18:02:17 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@223533 c90b9560-bf6c-de11-be94-00142212c4b1
90 lines
2.5 KiB
XML
90 lines
2.5 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.17 $ -->
|
|
<!-- EN-Revision: 1.12 Maintainer: didou Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry id="function.current">
|
|
<refnamediv>
|
|
<refname>current</refname>
|
|
<refpurpose>Retourne l'élément courant du tableau</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>current</methodname>
|
|
<methodparam><type>array</type><parameter role="reference">array</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Chaque tableau entretient un pointeur interne, qui est initialisé
|
|
lorsque le premier élément est inséré dans le tableau.
|
|
</para>
|
|
<para>
|
|
<function>current</function> ne fait que retourner
|
|
l'élément courant pointé par le pointeur interne du
|
|
tableau <parameter>array</parameter>.
|
|
<function>current</function> ne déplace pas le pointeur.
|
|
Si le pointeur est au-delà du dernier élément de la liste,
|
|
<function>current</function> retourne &false;.
|
|
</para>
|
|
|
|
&return.falseproblem;
|
|
|
|
<note>
|
|
<simpara>
|
|
Vous ne serez pas capable de distinguer la fin d'un tableau avec
|
|
l'élément booléen &false;. Pour traverser correctement un tableau qui
|
|
peut contenir l'élément &false;, voyez la fonction
|
|
<function>each</function>.
|
|
</simpara>
|
|
</note>
|
|
|
|
<para>
|
|
<example>
|
|
<title>Exemple avec <function>current</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$transport = array('pied', 'velo', 'voiture', 'avion');
|
|
$mode = current($transport); // $mode = 'pied';
|
|
$mode = next($transport); // $mode = 'velo';
|
|
$mode = current($transport); // $mode = 'velo';
|
|
$mode = prev($transport); // $mode = 'pied';
|
|
$mode = end($transport); // $mode = 'avion';
|
|
$mode = current($transport); // $mode = 'avion';
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Voir aussi
|
|
<function>end</function>,
|
|
<function>key</function>,
|
|
<function>next</function>,
|
|
<function>prev</function>,
|
|
<function>reset</function>, et
|
|
<function>each</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
|
|
-->
|