Files
doc-fr/reference/strings/functions/str-split.xml
Yannick Torres 775b2a3c49 sync with EN
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@228249 c90b9560-bf6c-de11-be94-00142212c4b1
2007-01-27 21:59:27 +00:00

109 lines
2.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- EN-Revision: 1.5 Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<refentry id="function.str-split">
<refnamediv>
<refname>str_split</refname>
<refpurpose>
Convertit une chaîne de caractères en tableau
</refpurpose>
</refnamediv>
<refsect1>
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>str_split</methodname>
<methodparam><type>string</type><parameter>string</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>split_length</parameter></methodparam>
</methodsynopsis>
<para>
Convertit une chaîne de caractères en tableau. Si le paramètre optionnel
<parameter>split_length</parameter> est spécifié, le tableau retourné
sera découpé en sous-parties, chacune de taille
<parameter>split_length</parameter>, sinon, chaque sous-partie aura la
taille d'un caractère.
</para>
<para>
Cette fonction retourne &false; si <parameter>split_length</parameter>
est inférieur à 1. Si la longueur de <parameter>split_length</parameter>
est supérieure à celle de <parameter>string</parameter>, la chaîne
entière est retournée dans le premier (et seul) élément du tableau.
</para>
<para>
<example>
<title>Exemples d'utilisation de <function>str_split</function></title>
<programlisting role="php">
<![CDATA[
<?php
$str = "Salut Dave";
$arr1 = str_split($str);
$arr2 = str_split($str, 3);
print_r($arr1);
print_r($arr2);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Array
(
[0] => S
[1] => a
[2] => l
[3] => u
[4] => t
[5] =>
[6] => D
[7] => a
[8] => v
[9] => e
)
Array
(
[0] => Sal
[1] => ut
[2] => Dav
[3] => e
)
]]>
</screen>
</example>
</para>
<para>
Voir aussi <function>chunk_split</function>,
<function>preg_split</function>,
<function>explode</function>,
<function>count_chars</function>,
<function>str_word_count</function> et
<link linkend="control-structures.for">for</link>.
</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
-->