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
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
[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
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
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
5 matches
Mail list logo