PHP Child / The Two Halves

What actually happens before a web page reaches you

A page feels like a document sitting on a shelf, waiting to be picked up. Almost none of them are. Most are built to order, in the moment you ask for them, by a machine you will never see.

Open a site and something arrives almost immediately. The speed makes it feel like a file was simply handed over, the way a book is handed across a counter. Occasionally that is true. Far more often the page did not exist a second earlier. Your request travelled to a machine, that machine worked out who you might be, gathered the pieces it needed, arranged them into a finished page, and sent the result back. Then it forgot the whole episode and moved on to the next visitor. The page you are reading is the residue of a short burst of work that has already ended.

This is the split that gives our name its joke, and we will only make it once: a child element sits inside a parent, and the work described here sits inside the work you can see. Everything on this site concerns the inside half. Not the marks that describe a document, not the rules that colour it, not the behaviour that runs once it has landed in front of you. Our subject is the interval before any of that: what a machine does with your request while you are still waiting.

That interval is short but it is not simple. Something has to receive the request and decide what it means. Something has to decide whether the person asking is allowed to see what they asked for. Something has to fetch stored information, or a saved copy of an earlier answer, or both. Something has to notice when a piece is missing and decide whether to fail loudly, fail quietly, or serve a partial answer that is still useful. All of this happens in a fraction of a second, and it happens again, in full, for the next visitor.

For a beginner the useful realisation is that this half is deliberately hidden. You cannot inspect it the way you can inspect what arrived. You are shown the outcome, never the reasoning. That opacity is the entire point. It is why a shop can know what you have in your basket without telling you what it knows about stock levels. It is why a site can confirm a password without ever handing the password back. Work done out of sight is work an outsider cannot read, change or fake.

The consequences run further than most beginners expect. Because the hidden half is trusted and the visible half is not, every important decision has to be made on the hidden side. Because the hidden half costs real time and real capacity, decisions about what to build fresh and what to remember shape whether a site feels quick or sluggish. Because the hidden half holds the stored information, a mistake there is not a cosmetic problem: it is the difference between a private record staying private and not.

So this is the ground we cover. What the two halves are and why the boundary between them matters. What happens during a single request, and why one visitor is cheap while a thousand are not. How a site recognises you at all, given that the web is built to forget. And what typically goes wrong, framed as the reason each defensive habit exists rather than a tour of failures. None of it requires you to write anything. It requires you to picture the machine.