I have looked and looked for an example on this, but the only ones I have found are echoing the result of the str replace like this :
$malestr = str_replace("{name}", "$name", $rawstring);
echo "$malestr";
But this is not what I want, what I am trying to do is....... when I create a template, in the text box field for the message I would write :
Dear {name}, Thankyou for your order !.
Name being the person I am writing too, that is pulled from the $toPersonsName array when the email is sent :
So the result of this would be in the email as follows :
If the customer was called bob, it would be >>
Dear Bob, Thankyou for your order !.
Is this str_replace I need for this or is it something else, as I don't want to have to write
Dear <?php echo '$malestr';?>
every time I create a template, {name} would be better.
EDIT >>
If I do the following :
$name = 'BOB';
$rawstring = "$name";
$malestr = str_replace("{name}", "$name", $rawstring);
echo "$malestr";
echo "{name}";
It echos {name} , but not bob ??, yet $malestr echo's bob, how can I get {name} to echo bob ?