Starting PHPThis is the first part of a 5 part articles series to help you understand and start using php. An Introduction to PHPPHP was originally designed to create dynamic web pages and to be interpreted by the web server making it independent of the web client (browser) being used. It is mainly used in this context as a server side scripting language. How Server Side Scripting WorksHowever, you can use server scripting to create pages that can reach
any browser with just pure HTML as the script is processed on the
server.
PHP Files and File ExtensionsPHP scripts are commonly mixed with HTML code in the same document. So that the server knows to pass the file through the PHP script interpreter the files are given the php file extension. Because php script is mixed with HTML the interpreter needs some way of identifying what is php script, and what is HTML. The php script is identified to the interpreter by placing it inside the script tags: <?php or <? -------opening tag ?> ---------closing tag So if we take a look at the following file: <HTML> I've highlighted the php in yellow. If you placed this file on as server as test.php this is what you would see in a browser. If you then look at the source code. This is what you see: Notice that you don't see the php tags or code. This is because the interpreter as executed the code and returned pure HTML to the browser.
|
|||