You can use php function eval()
<?php
$string = "beautiful";
$time = "winter";
$str = 'This is a $string $time morning!';
echo $str. "<br>";
eval("\$str = \"$str\";");
echo $str;
?>
This will output
This is a $string $time morning!
This is a beautiful winter morning!