Use a strict naming convention. A $clean array is just one example.


Understand the timing of your scripts. Once it begins, the entire HTTP request has been received. Not until it finishes is the response sent.