|
Posted by Mike Willbanks on 10/24/05 06:06
Nicolaas,
> Does anyone know of a function that works like str_ireplace in PHP < 5?
mixed preg_replace ( mixed pattern, mixed replacement, mixed subject [,
int limit [, int &count]] )
then just run it with a flag of i. so take your example:
preg_replace('/b/i', 'a', 'c')
a better example of this would be:
$subject = 'this is my MOM';
$pattern = '/mom/i';
$replace = 'DAD';
echo preg_replace($pattern, $replace, $subject);
> str_ireplace(a,b,c) replaces a with b in c, just like str_replace, but case
> insensitive.
--
Mike Willbanks
Zend Certified Engineer
http://www.digitalstruct.com
Navigation:
[Reply to this message]
|