Parse error when setting header to HTTP status in PHP
<p>I can not figure out what is going wrong but on this simple PHP below, I am getting parse errors. </p>

<p>I am getting this error</p>

<pre><code>Parse error: syntax error, unexpected T_STRING in E:\Server\htdocs\myframework\library\api\rest-test\index.php on line 3
</code></pre>

<p>on this code</p>

<pre><code>&lt;?php
header('HTTP/1.1 404 Not Found'); 
header('Content-type: application/json');

$data = 'testing dgdg dfgdf gdf';// my code that returns the appropriate data;

echo json_encode($data);

?&gt;
</code></pre>

<p>However when I swap out <code>header('HTTP/1.1 404 Not Found');</code> for <code>header('HTTP/1.1 200 OK');</code>  then the error goes away.  Please help me understand this.  Testing on Windows with XAMPP</p>

<hr>

<p><strong>RESOLVED</strong></p>

<p>My original code had a blank space at the end of the <code>header('HTTP/1.1 404 Not Found');</code> line, removed that space and everything works as expected now.</p>
