Posted by lorento on 06/09/06 02:50
Just a variant method :
<?php
$search_str = "abc";
$main_str = "ABCDE";
$new_str = eregi_replace ("(abc)", "<span>\\1</span>", $main_str);
?>
Note: eregi_replace slower than preg_replace
regards,
Lorento
--
http://blog.deshot.com
http://www.deshot.com
milahu wrote:
> Use a regular expression :)
>
> $haystack = preg_replace(
> '/(abc)/i',
> '<span>$1</span>',
> $haystack
> );
[Back to original message]
|