You are here: Re: str_ireplace() for php4? « PHP Programming Language « IT news, forums, messages
Re: str_ireplace() for php4?

Posted by Toby Inkster on 03/12/06 02:06

Janwillem Borleffs wrote:

> 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.

What if $str contained "\1"?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 

Navigation:

[Reply to this 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

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