One very useful feature of PHP is that it allows you to set header information for the document you are generating. This header information can control a wide variety of things Ė forcing the userís browser to open the file in a certain application, or to redirect the user to another page, or to authenticate the user before proceeding, and so on.
By default, PHP files are treated as an HTML file by a userís browser, since the output rendered by the server is generally text or HTML. The default content type then for an HTML (or PHP) file is "text/html." When a browser encounters this content type, it opens the file itself and renders any HTML markup found within the file appropriately. This is good, as the primary purpose of an HTML page is to format and display information.
Note: It is important to place the header() function call at the top of our PHP file. Placing it lower may result in compilation errors, as all header information must be sent before any other content is output.