note 27246 deleted from function.preg-replace by sander
| From: | sander@php.net | Date: | Sat, 15 Feb 2003 15:23:04 +0000 |
| Subject: | note 27246 deleted from function.preg-replace by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43987@lists.php.net to get a copy of this message | ||
This worked for me:
$tmpl = "My name is %name%. I am from %country%.";
$str['name'] = 'Jaime';
$str['country'] = 'Brazil';
$msg = preg_replace("/%(\w+)%/e", "\$str['\\1']", $tmpl);