note 27246 added to function.preg-replace

From: Date: Thu, 28 Nov 2002 21:00:24 +0000
Subject: note 27246 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-40083@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); -- http://www.php.net/manual/en/function.preg-replace.php http://master.php.net/manage/user-notes.php?action=edit+27246 http://master.php.net/manage/user-notes.php?action=delete+27246 http://master.php.net/manage/user-notes.php?action=reject+27246

« previous php.notes (#40083) next »