Reply to Re: str_ireplace() for php4?

Your name:

Reply:


Posted by Janwillem Borleffs on 03/11/06 14:48

Simon wrote:
> Just out of curiosity, would it work if $needle, $str, $haystack had
> escape/special characters?
>

Good point. You need to escape reserved regular expression characters in
$needle as follows:

if (!function_exists('str_ireplace')) {
function str_ireplace($needle, $str, $haystack) {
$needle = preg_quote($needle, '/');
return preg_replace("/$needle/i", $str, $haystack);
}
}

$str and $haystack do not need to be modified.


JW

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация