PHP Basics
PHP code can sit in its own text file, or it can be integrated into the HTML of a web page. The characters <?php
mark the beginning of PHP code, and the characters ?>
mark the end of the code. Names of files containing PHP code generally have the extension .php rather than .html.
Figure 16-4 shows the "Hello, world!" program, which tradition dictates should be your first program in any language.
Figure 16-4. A basic PHP program
If you copy the contents of Figure 16-4 into a file, name it something ending in .php, and put the file into a directory accessible by a webserver that understands PHP, you'll see something like Figure 16-5.
Note
Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.