ereg_replace with assoc array?
| From: | Jaxon | Date: | Thu, 08 Feb 2001 22:21:41 +0000 |
| Subject: | ereg_replace with assoc array? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38821@lists.php.net to get a copy of this message | ||
Hi
Can I do this????
$string = file.tpl;
while (list($pattern, $replacement) = each($array)) {
ereg_replace ($pattern, $replacement, $string);
}
echo $string;
note some assumptions below:
$array contains an assoc array:
first foo
second bar
third rab
fourth oof
file.tpl is this:
some html {first}
more html {second}
even more html {third}
lots more html {fourth}
This seems like a slow way to do this...
any advice is welcome!
tia!
jaxon