philip Mon Feb 26 07:42:02 2007 UTC
Modified files:
/phpdoc/en/reference/strings/functions str-replace.xml
Log:
Added an example to help clarify how multiple replacements work,
this idea came from a user comment (ae at instinctive dot de)
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/strings/functions/str-replace.xml?r1=1.20&r2=1.21&diff_format=u
Index: phpdoc/en/reference/strings/functions/str-replace.xml
diff -u phpdoc/en/reference/strings/functions/str-replace.xml:1.20
phpdoc/en/reference/strings/functions/str-replace.xml:1.21
--- phpdoc/en/reference/strings/functions/str-replace.xml:1.20 Sun Oct 15
05:06:12 2006
+++ phpdoc/en/reference/strings/functions/str-replace.xml Mon Feb 26
07:42:02 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.20 $ -->
+<!-- $Revision: 1.21 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.str-replace">
<refnamediv>
@@ -96,6 +96,12 @@
// Processes \r\n's first so they aren't converted twice.
$newstr = str_replace($order, $replace, $str);
+// Outputs: apearpearle pear
+$letters = array('a', 'p');
+$fruit = array('apple', 'pear');
+$text = 'a p';
+$output = str_replace($letters, $fruit, $text);
+echo $output;
?>
]]>
</programlisting>