How does header() work?
<p><strong>A little context:</strong><br>
I needed to run PHP scripts in a browser, but I didn't want to go to all the trouble of installing a server and suffer the overhead of running a server on my computer and all the stuff that goes with it, including firewalls, blah blah blah.</p>

<p>So instead I wrote my own server. It's a simple PHP script that listens for connections on port 80 of my LAN IP, then I just load that IP in my browser and it works. It receives the HTTP request and starts a second PHP script using <code>exec</code> - this is so that I can make changes to it easily without having to restart the server script. This second PHP script parses the request, and finally <code>include</code>s the script that was actually being called. It gets the output from there, and sends the response back to the browser with appropriate headers (which I can change).</p>

<p>Yeah, it's a mess, but it works. It does what I need it to do.</p>

<p><strong>Now for the question:</strong><br>
I can't use <code>header()</code>. It doesn't seem to be having any effect on what gets sent back to the browser through the socket connection. I have instead made a <code>setheader()</code> function, and store headers in an array to be prepended to the response.</p>

<p>I'd like to know how the <code>header()</code> function actually works internally, so that I might be able to use that function instead of my "hacked" one.</p>
