Q:

How to take a string containing HTML tags and php variables into a php string variable?

Suppose I have a string as
    Hi, <br><br>
Someone has shared a <?php echo $job_type ?> with you through <?php echo CHtml::link(Yii::params['Data_Port'], Yii::app()->getBaseUrl(true)); ?>.<br><br>
Title: <?php echo $job_title;?><br><br>
<?php echo CHtml::link("View"." ".ucfirst($job_type)." "."Details", $job_link); ?>

How can I put this whole string into a php variable so that all the php variables are converted into their respective values?

A:

You should try this,
<?php 
$str='';
$str.="Hi, <br><br> Someone has shared a ";
$str.=$job_type;
$str."with you through";
$str.=CHtml::link(Yii::params['Data_Ports'], Yii::app()->getBaseUrl(true));
$str.="<br><br>";
$str.="Title:";
$str.=CHtml::link("View"." ".ucfirst($job_type)." "."Details", $job_link);
?>

