What is the best way to replace a set of short tags in a PHP string, for example:
$return = "Hello %name%, thank you for your interest in the %product_name%. %representative_name% will contact you shortly!";
Where would I determine that% name% is a specific string, from an array or object, for example:
$object->name;
$object->product_name;
etc..
I know that I could run str_replace several times on a line, but I was wondering if there is a better way to do this.
Thank.
source
share