1
0
mirror of https://github.com/php/doc-fr.git synced 2026-03-29 18:42:07 +02:00
Files
archived-doc-fr/reference/strings/functions/explode.xml
Yannick Torres f7a8933317 synch with EN Revision
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@158790 c90b9560-bf6c-de11-be94-00142212c4b1
2004-05-17 22:10:36 +00:00

99 lines
3.2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
<refentry id="function.explode">
<refnamediv>
<refname>explode</refname>
<refpurpose>Coupe une chaîne en segments</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>explode</methodname>
<methodparam><type>string</type><parameter>separator</parameter></methodparam>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>limit</parameter></methodparam>
</methodsynopsis>
<para>
<methodname>explode</methodname> retourne un tableau de chaînes.
Ce sont les sous-chaînes, extraites de <parameter>string</parameter>,
en utilisant le séparateur <parameter>separator</parameter>.
Si <parameter>limit</parameter> est fourni, le tableau retourné aura
un maximum de <parameter>limit</parameter> éléments, et le dernier
élément du tableau contiendra le reste de la chaîne <parameter>string</parameter>.
</para>
<para>
Si <parameter>separator</parameter> est une chaîne vide (""),
<function>explode</function> retournera &false;. Si
<parameter>separator</parameter> contient une valeur qui n'est pas contenue
dans <parameter>string</parameter>, alors <function>explode</function>
retournera un tableau, contenant la chaîne <parameter>string</parameter>
entière.
</para>
<para>
Bien que <function>implode</function> puisse, pour des raisons historiques,
accepter ces paramètres dans n'importe quel ordre,
<function>explode</function> ne le peut pas.
Vous devez vous assurer que le paramètre <parameter>separator</parameter>
soit placé AVANT le paramètre <parameter>string</parameter>.
</para>
<note>
<para>
Le paramètre <parameter>limit</parameter> a été
ajouté en &php; 4.0.1.
</para>
</note>
<para>
<example>
<title>Exemple avec <function>explode</function></title>
<programlisting role="php">
<![CDATA[
<?php
// Exemple 1
$pizza = "pièce1 pièce2 pièce3 pièce4 pièce5 pièce6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // pièce1
echo $pieces[1]; // pièce2
// Exemple 2
$data = "foo:*:1023:1000::/home/foo:/bin/sh";
list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data);
echo $user; // foo
echo $pass; // *
?>
]]>
</programlisting>
</example>
</para>
<para>
Voir aussi
<function>preg_split</function>,
<function>spliti</function>,
<function>split</function> et
<function>implode</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
-->