First “Hello Word” Program

The first thing you need to learn about PHP is how it is embedded in HTML:

<HTML>

<HEAD>Sample PHP Script</HEAD>

<BODY>

The following prints “Hello, World”:

<?php

print “Hello, World”;

?>

</BODY>

</HTML>

In this example, you see that your PHP code sits embedded in your HTML. Every time the PHP interpreter reaches a PHP open tag <?php , it runs the enclosed code up to the delimiting ?> marker.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s