Added extra example showing stripping of whitespace (this question is asked atleast 3 times a day)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@174081 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Aidan Lister 2004-12-05 15:12:10 +00:00
parent d2a5d982a4
commit 996071ceab

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- $Revision: 1.13 $ -->
<!-- splitted from ./en/functions/pcre.xml, last change in rev 1.2 -->
<refentry id="function.preg-replace">
<refnamediv>
@ -247,6 +247,25 @@ $replace = array ("",
$text = preg_replace($search, $replace, $document);
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Strip whitespace</title>
<para>
This example strips excess whitespace from a string.
</para>
<programlisting role="php">
<![CDATA[
<?php
$str = 'foo o';
$str = preg_replace('/\s\s+/', ' ', $str);
// This will be 'foo o' now
echo $str;
?>
]]>
</programlisting>
</example>