PHP Child / The Two Halves

Before it is sent, and after it arrives

The single most useful line to draw when you are learning is the one between work done at the source and work done at the destination.

Picture a meal. One version is cooked in a kitchen and carried out finished. Another arrives as ingredients with instructions, and is assembled at the table. Web pages come both ways, and usually as a mixture. Work done before sending happens on a machine the site controls, using information the site holds, at a time nobody is watching. Work done after arriving happens on your own device, in the open, using only what was sent to you. The finished plate can look identical either way. What differs is who did the work, what they had access to while doing it, and who could have interfered.

That difference is not academic. Anything decided before sending was decided using the full picture: stored records, current stock, whether a person is signed in, what they are permitted to see. Anything decided after arriving was decided with only the fragment that was sent, on a device the site does not own and cannot vouch for. So the two halves are not interchangeable, even when they produce the same visible result. Choosing which half does a piece of work is one of the first real design decisions anyone learning this makes.

The habit worth forming early is to ask, of every behaviour you see on a site, where it was decided. A price that changes when you pick a size might have been calculated at the source or worked out on the spot from a small table sent along with the page. Both are legitimate. But only one of them is a fact the site has stood behind, and only one of them can be relied upon when money is involved.