End delimter

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

End delimter

Post by ol4pr0 »

Yes / No Question ( no end delimeter specified in.. )

Code: Select all

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

# should become 
'/é/' => "é",
'/ó/' => "ó",
'/á/' => "á",
'/í/' => "í",
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

For preg_replace, yeah, although I don't see why a strtr wouldn't work.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post 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 ? ...
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post 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 :(
Post Reply