Question: I have a PHP page where the header and footer are PHP includes.

I want to know if there is any possibility of the includes loading asynchronously - or does PHP gather all the files required, compile them and send them as one file?

The reason I ask is that I've seen an interesting PHP app that seemed to keep the connection open and do things in sequence before closing the connection - I wondered if that's what happens with includes.

PHP version is 5.3.6

EDIT:
What I actually want is for the page to load all at once, to prevent my layout mashing as each bit loads. Sorry to any who misunderstood this

Answer: 
Generally any output will be output as it is generated.

```
echo 'A';
sleep(1000);
echo 'B';
sleep(1000);
echo 'C';

```

This slowly outputs "ABC". Includes are included when they are encountered, the same way `echo` outputs anything at that specific point. It's all in order, never asynchronously.

A web server *may* buffer all output before sending any of it to the client. In the above example, you'd receive "ABC" all together after 2 seconds of nothing.
PHP sends a single document. What you want to do is achieved with something called AJAX (<http://en.wikipedia.org/wiki/Ajax_%28programming%29>)

Basically you write some JavaScript code that uses XMLHTTPRequest object to connect to the server and download some extra info.