View Single Post
  #7 (permalink)  
Old 08-08-03, 03:45 PM
RocketPack.net RocketPack.net is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Actually the preg functions are much faster than the ereg functions, as noted here: http://www.php.net/ereg
"Note: preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg()."

I thought that this might interest you-
http://www.php.net/str_replace
"In PHP 4.0.5 and later, every parameter to str_replace() can be an array."

Meaning, if you make an array of finds, an array of replaces, you would only have to make 1 call to str_replace.
ie:
$find = array('[br]', '[hr]', '[oo]', '[xx]', '[ту]');
$replace = array('<br>', '<hr>', "<img src='img/[oo].gif'>", "<img src='img/[xx].gif'>", "<img src='img/[enojado].gif'>");
$texto = str_replace($find, $replace, $texto);

Good luck!
Reply With Quote