PHP | Use Of strtr() function

Author - Webner

In PHP if you want to replace multiple variables of the string at one go you could use strtr() instead of using str_replace().

Example :

$vars = array(
		'##session_date##'=>$sessiondate,
		'##session_time##'=>$sessiontime,
		'##conferencelinenumber##' =>$conferencelinenumber,
		'##pincode##' =>$pincode,
		'##coachingcommnets##'=>$coachingcomments,
		'##actioncommitmnets##'=>$actioncommitmnets,
		'##reminders##'=>   '  ',
		'##name##' =>$name,
		'##breakline##'=>'<br><br>',
	   );
$BODY=strtr($body, $vars);

Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at webdevelopment@webners.com

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *