Files
doc-fr/reference/strings/functions/wordwrap.xml
T
Yannick Torres f5c7546101 sync with EN version
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@166904 c90b9560-bf6c-de11-be94-00142212c4b1
2004-08-20 16:20:28 +00:00

121 lines
3.1 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.16 $ -->
<!-- EN-Revision: 1.13 Maintainer: didou Status: ready -->
<refentry id="function.wordwrap">
<refnamediv>
<refname>wordwrap</refname>
<refpurpose>
Effectue la césure d'une chaîne
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>wordwrap</methodname>
<methodparam><type>string</type><parameter>str</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>width</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>break</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>cut</parameter></methodparam>
</methodsynopsis>
<para>
<function>wordwrap</function> retourne la chaîne
<parameter>str</parameter>, après avoir inséré
<parameter>break</parameter> tous les <parameter>width</parameter>
caractères.
</para>
<para>
Par défaut, <function>wordwrap</function> va automatiquement
insérer une nouvelle ligne en utilisant <literal>\n</literal> tous les
75 caractères, si <parameter>width</parameter> ou
<parameter>break</parameter> ne sont pas fournis.
</para>
<para>
Si le paramètre <parameter>cut</parameter> est mis à 1, la césure de
la chaîne sera toujours à la taille <parameter>width</parameter>. Si vous
avez un mot qui est plus long que la taille de césure, il sera
coupé en morceaux. (Voir le second exemple.)
<note>
<para>
Le paramètre optionnel <parameter>cut</parameter> a
été ajouté en &php; 4.0.3.
</para>
</note>
</para>
<para>
<example>
<title>Exemple avec <function>wordwrap</function></title>
<programlisting role="php">
<![CDATA[
<?php
$text = "Portez ce vieux whisky au juge blond qui fume.";
$newtext = wordwrap( $text, 20 );
echo "$newtext\n";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Portez ce vieux
whisky au juge
blond qui fume.
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Exemple avec <function>wordwrap</function> avec césure</title>
<programlisting role="php">
<![CDATA[
<?php
$text = "Un mot très très loooooooooooooooooong.";
$newtext = wordwrap($text, 8, "\n", 1);
echo "$newtext\n";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Un mot
très
très
looooooo
oooooooo
ooong.
]]>
</screen>
</example>
</para>
<para>
Voir aussi
<function>nl2br</function> et
<function>chunk_split</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
-->