IN THIS CHAPTER
Ajax developers work on the server as well as in the browser, of course, and the most common server-side language used with Ajax these days is PHP. Accordingly, this chapter and Chapter 13 give you an introduction to using PHP with Ajax.
You can embed your PHP scripts inside HTML pages if you enclose the scripts in special markup. In code, you should enclose your PHP scripts (which are stored in files with the extension .php) inside the markup <?php and ?> like this:
<?php . . . PHP goes here . . . ?>
However, in practice, you can use <? and ?>, and the server will still understand:
<? . . . PHP goes here . . . ?>
A PHP-enabled server will execute the PHP code inside the <?...?> markup. Here's an example that runs the built-in PHP function phpinfo, phpinfo.php, which creates an HTML table that tells you about your PHP installation.
<html> <head> <title> A first PHP example </title> </head> <body> <h1> A first PHP example </h1> <? phpinfo(); ...