I am learning to code using AngularJS and php and have been stuck while trying to write the value of one of the variable to a text file using PHP.
My variable is,
{{sample.getString()}}
When I try to print it using php it works for me,
<?php echo "{{sample.getString()}}" ?>
however, when I try to write it in a text file,
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "{{sample.getString()}}";
echo $txt;
fwrite($myfile, $txt);
fclose($myfile);
?>
It writes the variable itself instead of writing the value of the variable.
Can someone please tell me how can i fix this ?