PDA

View Full Version : Vb-style "replacements"



Gamefreak
Sun 12th May '02, 3:30pm
I am making a template-based web site, and I would like to know how vbulletin replaces the replacements so quickly. I can use "eregi_replace()", but it takes a while. Can anyone help me?

Mark Hensler
Sun 12th May '02, 7:49pm
I'm not familiar with vB coding, so I can't comment on that. But..

eregi() is slower than preg_replace()

and even faster is str_replace()

Gamefreak
Sun 12th May '02, 9:02pm
Thanks for the help anyways.

Chen
Mon 13th May '02, 7:26am
$formattedText = str_replace('{replacementvariable}', '#000000', $text);
You can also use arrays with str_replace(), check out the PHP docs for more info.