Page 1 of 1

End delimter

Posted: Fri Apr 29, 2005 4:13 pm
by ol4pr0
Yes / No Question ( no end delimeter specified in.. )

Code: Select all

'é' => "é",
'ó' => "ó",
'á' => "á",
'í' => "í",
#ect.. 

# should become 
'/é/' => "é",
'/ó/' => "ó",
'/á/' => "á",
'/í/' => "í",

Posted: Fri Apr 29, 2005 4:34 pm
by Ambush Commander
For preg_replace, yeah, although I don't see why a strtr wouldn't work.

Posted: Fri Apr 29, 2005 4:37 pm
by ol4pr0
That might do it aswell. Dont know havent checked it.
Somehow preg_replace is the first thing that comes into my mind :)

strtr Faster ? Better ? ...

Posted: Fri Apr 29, 2005 4:40 pm
by Ambush Commander
Supposedly, Strtr is cleaner, but slower than str_rpelace.

Personally, when it comes to this fine-grained type of optimization, you should build the benchmark yourself.

Posted: Fri Apr 29, 2005 4:43 pm
by ol4pr0
Hmm.. the slower part is something than that stops me from using strtr in this case. Its because i am pulling rather some data from a database and sending it to a large number or registered users. If not replacing it, it will end up in the famous Jmail :(