<?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>Webmaster Sucks &#187; case sensitive</title>
	<atom:link href="http://www.webmastersucks.com/tags/case-sensitive/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webmastersucks.com</link>
	<description>Here I share stuff I used to suck at as a novice webmaster..</description>
	<lastBuildDate>Tue, 11 May 2010 10:56:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>str_replace Case Sensitive Problem</title>
		<link>http://www.webmastersucks.com/str_replace-case-sensitive-problem/</link>
		<comments>http://www.webmastersucks.com/str_replace-case-sensitive-problem/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 09:17:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[case sensitive]]></category>
		<category><![CDATA[ext_str_ireplace]]></category>
		<category><![CDATA[find and replace]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[str_ireplace]]></category>
		<category><![CDATA[str_ireplace php]]></category>
		<category><![CDATA[str_replace]]></category>
		<category><![CDATA[str_replace case sensitive]]></category>
		<category><![CDATA[str_replace php]]></category>

		<guid isPermaLink="false">http://www.webmastersucks.com/?p=231</guid>
		<description><![CDATA[
			
				
			
		
When i use str_replace for replacement in PHP, it is changing without any case sensitive. Example i want to bold HousE, code is
&#60;?
$text = &#34;I like my house.&#34;;
$string = &#34;HousE&#34;;
$text = str_replace($string,&#34;&#60;b&#62;$string&#60;/b&#62;&#34;,$text);
echo($text);
?&#62;

Php 5 have another function to solve this problem str_ireplace() . But this is solve my problem exactly. Because i want to replace case sensitive to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.webmastersucks.com%2Fstr_replace-case-sensitive-problem%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.webmastersucks.com%2Fstr_replace-case-sensitive-problem%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>When i use str_replace for replacement in PHP, it is changing without any case sensitive. Example i want to bold HousE, code is
<pre class="brush: php;">&lt;?
$text = &quot;I like my house.&quot;;
$string = &quot;HousE&quot;;
$text = str_replace($string,&quot;&lt;b&gt;$string&lt;/b&gt;&quot;,$text);
echo($text);
?&gt;
</pre>
<p>Php 5 have another function to solve this problem <a href="http://tr.php.net/manual/en/function.str-ireplace.php" target="_blank">str_ireplace()</a> . But this is solve my problem exactly. Because i want to replace case sensitive to case sensitive.  I found this solution for my problem. I hope you&#8217;ll enjoy.</p>
<pre class="brush: php;">

function ext_str_ireplace($findme, $replacewith, $subject)
{
     // Replaces $findme in $subject with $replacewith
     // Ignores the case and do keep the original capitalization by using $1 in $replacewith
     // Required: PHP 5

     $rest = $subject;
     $result = '';

     while (stripos($rest, $findme) !== false) {
          $pos = stripos($rest, $findme);

          // Remove the wanted string from $rest and append it to $result
          $result .= substr($rest, 0, $pos);
          $rest = substr($rest, $pos, strlen($rest)-$pos);

          // Remove the wanted string from $rest and place it correctly into $result
          $result .= str_replace('$1', substr($rest, 0, strlen($findme)), $replacewith);
          $rest = substr($rest, strlen($findme), strlen($rest)-strlen($findme));
     }

     // After the last match, append the rest
     $result .= $rest;

     return $result;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.webmastersucks.com/str_replace-case-sensitive-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
