For some reason, when passing a php variable to javascript using the following code.
JS:
var myVar = "<?php echo $pass ?>";
document.getElementById("output").innerHTML = myVar;
console.log(myVar);
And the PHP:
<?php
$myfile = fopen("testfile.txt", "r");
$pass = fread($myfile,filesize("testfile.txt"));
fclose($myfile);
?>
But instead of outputting the text in the file, "This is some text", it outputs the raw php code and not executing it: "
When looking at the p element in the Inspector, it is this:
<p id="output"><!--?php echo $pass;?--></p>