RE: [PHP] Replacing template variables with values?

From: Date: Thu, 02 Aug 2001 14:22:15 +0000
Subject: RE: [PHP] Replacing template variables with values?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-60910@lists.php.net to get a copy of this message
try using single quotes : preg_replace("/\$(\w+)/e", '${$1}', $template); > -----Original Message----- > From: Ryan Fischer [mailto:ryan@gigabee.com] > Sent: Wednesday, August 01, 2001 6:37 PM > To: php-general@lists.php.net > Subject: [PHP] Replacing template variables with values? > > > Hello! :) > > I have a form with a textarea that contains a template e-mail with > variables in it. I would like to be able to replace those variables > with values. The variables named in the template are actual variables > in my script. This doesn't seem to work: > > $newmail = preg_replace("/\$(\w+)/e", ${$1}, $template); > > ...and neither does anything I've tried to do as far as eval() goes. I > either get a parse error like this: > > Parse error: parse error, expecting T_VARIABLE' or > '$'' in > c:\path\file.php on line 16 > > ...or some other sort of eval() error. Any ideas? TIA! :) > > -- > -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#60910) next »