On Mon, 4 Oct 2004, Chuck Wolber wrote: > Database *FIELD* with text data in it. The text data contains sentences > interspersed with $foo['bar'] array variables. The idea is that when one > selects this field, PHP will interpolate $foo['bar'] with the currently > defined $foo array variable. This allows for "form letter" like > dispatches to be created. The method I've come up with in the meantime, I believe is much more effective than heredocs, but still an ugly hack: function interpolate ($text, $msg_variable) { $msg_key = '_FP_VAR_'; foreach (array_keys($msg_variable) as $key) { $token = $msg_key.$key; $text = preg_replace("/$token/", "$msg_variable[$key]", $text); } return ($text); } -- http://www.quantumlinux.com Quantum Linux Laboratories, LLC. ACCELERATING Business with Open Technology "The measure of the restoration lies in the extent to which we apply social values more noble than mere monetary profit." - FDR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php