Level 67
Aug 26, 2019
1
Level 2
Replace all parameter variables with values in string templates
I have templates for emails, I want to replace all occurrences with variable values in the template. Example:
$template = <p>Hi {applicant_name},</p>
<br>
<p>You are welcomed to {org_name}</p>, Your salary is {salary}
<br>
<p>
-<br>{company_name}</p>
I have
$applicant_name = "John";
$org_name = "ITF";
$salary = 50000
$company_name = "ABC"
How i can do it in laravel with a single function? I want to replace template of variables with real variable names.
Please or to participate in this conversation.