Learning the PHP Language

Delimiting PHP Code

PHP was developed as an HTML template language, with the intention of making it easy to intersperse snippets of executable PHP code amongst sections of static HTML output. For this reason, any section of PHP code starts with the processing instruction (PI) <?php and ends with the closing delimiter ?>. So, for example, a PHP page that prints the current date could consist of the following code:

<html>
<head><title>Today's date</title></head>
<body>
<p>Today's date is:
<?php echo date('Y-m-d'); ?>
</p>
</body></html>

The PHP interpreter loads the page, automatically returns all of the HTML leading up to the PHP code <?php echo date('Y-m-d'); ?>, interprets and returns the results of the PHP code, ...

Get Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ 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.