mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-28 11:13:14 +02:00
5090d2852c
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@138809 c90b9560-bf6c-de11-be94-00142212c4b1
85 lines
2.5 KiB
XML
85 lines
2.5 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 'asort' in en/ tree in rev 1.2 -->
|
|
<refentry id="function.asort">
|
|
<refnamediv>
|
|
<refname>asort</refname>
|
|
<refpurpose>Trie un tableau en ordre</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>asort</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>asort</function> trie un tableau de telle manière que
|
|
la corrélation entre les index et les valeurs soit conservée.
|
|
L'usage principal est lors de tri de tableaux associatifs où l'ordre
|
|
des éléments est important.
|
|
<example>
|
|
<title>Exemple avec <function>asort</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$fruits = array( "d"=>"papaye",
|
|
"a"=>"orange",
|
|
"b"=>"banane",
|
|
"c"=>"ananas");
|
|
asort($fruits);
|
|
for(reset($fruits); $key = key($fruits); next($fruits)) {
|
|
echo "fruits[$key] = ".$fruits[$key]."\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
Cet exemple va afficher:
|
|
<computeroutput>
|
|
<![CDATA[
|
|
fruits[c] = ananas
|
|
fruits[b] = banane
|
|
fruits[a] = orange
|
|
fruits[d] = papaye
|
|
]]>
|
|
</computeroutput>
|
|
Les fruits ont été triés par ordre alphabétique,
|
|
et leurs index respectifs ont été conservés.
|
|
</para>
|
|
<para>
|
|
Vous pouvez modifier le comportement de cette fonction en utilisant
|
|
le paramètre optionnel <parameter>sort_flags</parameter>. Pour plus
|
|
de détails, voyez le manuel pour la fonction <function>sort</function>.
|
|
</para>
|
|
<para>
|
|
Voir aussi
|
|
<function>arsort</function>,
|
|
<function>rsort</function>,
|
|
<function>ksort</function> et
|
|
<function>sort</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
|
|
-->
|