Introduction

|

PHP is a language that was designed to be easily embedded into HTML pages. Most PHP pages have PHP code and HTML intermixed. When a Web server reads a PHP page, it is looking for two things to let it know it should start reading the page as PHP rather than HTML, the start and end PHP tags: <?php and ?>, respectively.

Get Started:

<h1><? echo “First PHP Page.”; ?>!</h1>

The code above, when viewed via a Web server, simply prints out String enclosed in the quotes.

In general, individual lines of PHP code should end with a semicolon, although it is not necessary to use semicolons if a beginning or an ending bracket is used (this will make sense when you look at if/then statements).

For example:

<?

echo "<p>a line of code";

echo "<p>another line of code;

?>






 

©2009