PHP scripts are plain text files that can contain a mixture of HTML and PHP code. The script is interpreted to produce a Web page as output that is sent to the client. The HTML is copied to the output without interpretation. PHP code is interpreted and replaced by whatever output the code produces. PHP begins interpreting a file in HTML mode. You can switch into and out of PHP code mode using special tags that signify the beginning and end of PHP code. You can switch between modes any number of times within a file. PHP understands four types of tags, although some of them must be explicitly enabled if you want to use them. One way to do this is by turning them on in the PHP initialization file, php.ini (php3.ini in PHP 3). The location of this file is system dependent; on many UNIX systems, it's found in /usr/lib or /usr/local/lib. On Windows, look in the Windows system directory. PHP understands the following tag styles:
The examples in this appendix use <?php and ?> for the opening and closing tags. |