mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
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:
parent
d2a5d982a4
commit
996071ceab
1 changed files with 20 additions and 1 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue