title: reading multiple lines in a txt file not working in php
body: <p>I am trying to read a txt file with multiple lines and console.log it but I'm running into an error. The error only persists when trying to read a file with multiple lines. If the txt file only has one line it works perfectly and console.logs the line. I have tried using the fgets method and file_get_contents method but they both produce the same error which is <code>SyntaxError: Invalid or unexpected token</code>. What is wrong with my code. Any help is appreciated. Thanks in advance.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
    $file = fopen("test.txt","r");
    $let = fgets($file); //Don't work
    $let = file_get_contents("test.txt"); //Don't work
    fclose($file);
  ?&gt;
  
  &lt;script&gt;
    var val = "&lt;?=$let?&gt;";
    console.log(val); //error: SyntaxError: Invalid or unexpected token
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>