Re: [PHP] best way todo a case insensitive str_replace

2005-02-21 Thread John Nichel
pmpa wrote: Hi all. What is the best way to do a string insensitive replace? Currently I am doing: $replace = "g r"; $arr = explode(" ",$replace); $text = "PHP is GreaT!"; for($i=0;i".strtolower($arr[$i])."",$text); $text = str_replace(strtoupper($arr[$i]),"".strtoupper($arr[$i])."",$text); } Works

Re: [PHP] best way todo a case insensitive str_replace

2005-02-21 Thread Ville Mattila
pmpa wrote: What is the best way to do a string insensitive replace? Currently I am doing: I would encourage you to use eregi_replace function that uses regular expressions. $text = eregi_replace("([gr])", "\\1", $text); Ville -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visi

RE: [PHP] best way todo a case insensitive str_replace

2005-02-21 Thread Jay Blanchard
[snip] What is the best way to do a string insensitive replace? [/snip] http://us2.php.net/manual/en/function.eregi-replace.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] best way todo a case insensitive str_replace

2005-02-21 Thread Guillermo Rauch
http://ar2.php.net/str_ireplace On Mon, 21 Feb 2005 15:54:33 -, pmpa <[EMAIL PROTECTED]> wrote: > Hi all. > > What is the best way to do a string insensitive replace? > Currently I am doing: > > $replace = "g r"; > $arr = explode(" ",$replace); > $text = "PHP is GreaT!"; > for($i=0;i $text

[PHP] best way todo a case insensitive str_replace

2005-02-21 Thread pmpa
Hi all. What is the best way to do a string insensitive replace? Currently I am doing: $replace = "g r"; $arr = explode(" ",$replace); $text = "PHP is GreaT!"; for($i=0;i".strtolower($arr[$i])."",$text); $text = str_replace(strtoupper($arr[$i]),"".strtoupper($arr[$i])."",$text); } Works except f