For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > February 2007 > cvs: phpdoc /en/reference/strings/functions str-replace.xml









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: phpdoc /en/reference/strings/functions str-replace.xml
Philip Olson

2007-02-26, 4:00 am

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/phpdo...1&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>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com