philip          Thu Jul 24 01:07:16 2003 EDT

  Modified files:              
    /phpdoc/en/reference/strings/functions      str-replace.xml 
  Log:
  Added examples do demonstrate uses with arrays, as well as the count parameter.
  
  
Index: phpdoc/en/reference/strings/functions/str-replace.xml
diff -u phpdoc/en/reference/strings/functions/str-replace.xml:1.8 
phpdoc/en/reference/strings/functions/str-replace.xml:1.9
--- phpdoc/en/reference/strings/functions/str-replace.xml:1.8   Fri Jun 20 13:49:06 
2003
+++ phpdoc/en/reference/strings/functions/str-replace.xml       Thu Jul 24 01:07:16 
2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
 <!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
   <refentry id="function.str-replace">
    <refnamediv>
@@ -62,11 +62,27 @@
     </para>
     <para>
      <example>
-      <title><function>str_replace</function> example</title>
+      <title><function>str_replace</function> examples</title>
       <programlisting role="php">
 <![CDATA[
 <?php
-$bodytag = str_replace("%body%", "black", "<body text=%body%>");
+// Provides: <body text='black'>
+$bodytag = str_replace("%body%", "black", "<body text='%body%'>");
+
+// Provides: Hll Wrld f PHP
+$vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
+$onlyconstants = str_replace($vowels, "", "Hello World of PHP");
+
+// Provides: You should eat pizza, beer, and ice cream every day
+$phrase  = "You should eat fruits, vegetables, and fiber every day.";
+$healthy = array("fruits", "vegetables", "fiber");
+$yummy   = array("pizza", "beer", "ice cream");
+
+$newphrase = str_replace($healthy, $yummy, $phrase);
+
+// Use of the count parameter is available as of PHP 5.0.0
+$str = str_replace("ll", "", "good golly miss molly!", $count);
+echo $count; // 2
 ?>
 ]]>
       </programlisting>



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to