diff --git a/reference/strings/functions/str-replace.xml b/reference/strings/functions/str-replace.xml index 6ce8e5298f..e3bc489824 100644 --- a/reference/strings/functions/str-replace.xml +++ b/reference/strings/functions/str-replace.xml @@ -1,5 +1,5 @@ - + @@ -62,11 +62,27 @@ - <function>str_replace</function> example + <function>str_replace</function> examples "); +// Provides: +$bodytag = str_replace("%body%", "black", ""); + +// 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 ?> ]]>