title: PHP not checking script file
body: <p>I have a php file that contains a javascript object (which is in part echoed by php). That file is called by:</p>
  
  <pre><code>&lt;script src="js/file.php"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>The contents of the file are basically:</p>
  
  <pre><code>&lt;?php
  header('Content-Type: text/javascript');
  $custom_icons = JSON_encode($object);
  ?&gt;
  
  var JSON_icons = &lt;?php echo $custom_icons ?&gt;;
  
  
  var icons = JSON_icons + {
      "facebook": {'name': 'facebook', 'text': 'Facebook', 'icon_url': 'img/logos/facebook.png', 'url': 'http://www.facebook.com'}
  };
  </code></pre>
  
  <p>Please ignore any coding / syntax errors that might appear due to the shortening of the script. The problem I'm having is that when the script is called, javascript throws the error:</p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token &lt; 
  </code></pre>
  
  <p>Which basically means php didn't go through the file and print what it should. It basically left the file untouched and the php code remained there.</p>
  
  <p>How can I solve this? I'm really lost here.</p>
  
  <p>Thank you!</p>
  
  <p><strong>UPDATE:</strong> PHP actually checked the file, found some errors, and consequentially echoed them using html elements. The invalid '&lt;' token comes from a <code>&lt;br/&gt;</code> printed by php and not from the <code>&lt;?php</code> tag itself, like I (dumbly) thought.</p>