<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Tutorials Code Snippets and Php Tips &#187; string replace</title>
	<atom:link href="http://readytousesolutions.com/phpblog/tag/string-replace/feed/" rel="self" type="application/rss+xml" />
	<link>http://readytousesolutions.com/phpblog</link>
	<description>PHP tutorials - Examples of the most useful scripts</description>
	<lastBuildDate>Thu, 23 Sep 2010 06:54:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP Tutorial : Multiple string replace with str_replace</title>
		<link>http://readytousesolutions.com/phpblog/php-tutorial-multiple-string-replace-with-str_replace/</link>
		<comments>http://readytousesolutions.com/phpblog/php-tutorial-multiple-string-replace-with-str_replace/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 04:58:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Basic PHP]]></category>
		<category><![CDATA[php multi str_replace]]></category>
		<category><![CDATA[php multiple string replace]]></category>
		<category><![CDATA[php multiple str_replace]]></category>
		<category><![CDATA[php string replace]]></category>
		<category><![CDATA[php str_replace]]></category>
		<category><![CDATA[string replace]]></category>
		<category><![CDATA[str_replace]]></category>

		<guid isPermaLink="false">http://www.crivionweb.com/phpblog/?p=255</guid>
		<description><![CDATA[Well, I already writed about str_replace php function but this tip is very usefull. To recap, the function it&#8217;s used to replace a string by using three paramaters : $stringToSearch, $stringToReplace, $intoString. I showed you how to use it in &#8230; <a href="http://readytousesolutions.com/phpblog/php-tutorial-multiple-string-replace-with-str_replace/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, I already writed about str_replace php function but this tip is very usefull. To recap, the function it&#8217;s used to replace a string by using three paramaters : $stringToSearch, $stringToReplace, $intoString. I showed you how to use it in single operations but we can use it for multiple replaces in one place, by using arrays :</p>
<pre class="php">
<span class="phpScriptTag"><span class="phpOperator">&lt;</span><span class="phpOperator">?</span>php</span>
$searchArray <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span><span class="phpString">"word1"</span>, <span class="phpString">"sound2"</span>, <span class="phpString">"etc3"</span><span class="phpOperator">)</span><span class="phpText">;</span>
$replaceArray <span class="phpOperator">=</span> <span class="phpFunction">array</span><span class="phpOperator">(</span><span class="phpString">"word one"</span>, <span class="phpString">"sound two"</span>, <span class="phpString">"etc three"</span><span class="phpOperator">)</span><span class="phpText">;</span>
$intoString <span class="phpOperator">=</span> <span class="phpString">"Here is word1,<span class="phpKeyword"> as </span>well sound2 and etc3"</span><span class="phpText">;</span>
<span class="phpComment">//now let&#039;s replace
</span>
<span class="htmlText">
print </span><span class="phpFunction">str_replace</span><span class="phpOperator">(</span>$searchArray, $replaceArray, $intoString<span class="phpOperator">)</span><span class="phpText">;</span>
<span class="phpComment">//it should print <span class="phpString">"Here is word one,<span class="phpKeyword"> as </span>well sound two and etc three"</span>
</span>
<span class="phpScriptTag"><span class="phpOperator">?</span><span class="phpOperator">&gt;</span></span>
</pre>
<p>I have to say this multiple replace &#8220;trick&#8221; is a very nice one!</p>
<p>See ya soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://readytousesolutions.com/phpblog/php-tutorial-multiple-string-replace-with-str_replace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

