HOW TO WRITE PHP SCRIPTS A typical PHP (Best web design)
HOW TO WRITE PHP SCRIPTS A typical PHP page will use some or all of the following elements: Variables to act as placeholders for unknown or changing values Arrays to hold multiple values Conditional statements to make decisions Loops to perform repetitive tasks Functions to perform preset tasks Let s take a quick look at each of these in turn. Telling the server to process PHP PHP is a server-side language. This means that the web server processes your PHP code and sends only the results usually as XHTML to the browser. Because all the action is on the server, you need to tell it that your pages contain PHP code. This involves two simple steps, namely: Give every page a PHP filename extension the default is .php. Do not use any thing other than .php unless you are told to specifically by your hosting company. Enclose all PHP code within PHP tags. The opening tag is . It doesn t matter whether you put the tags on the same line as surrounding code, but when inserting more than one line of PHP, it s a good idea to put the opening and closing tags on separate lines for the sake of clarity. You may come across as an alternative short version of the opening tag. However, doesn t work on all servers. Stick with tag. If the PHP code produces any output, it s inserted at that point. Then any remaining XHTML passes through until another Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.