Make your own free website on Tripod.com

Visit the Official PHP Website
Search this Site

PHP Programming - Lesson 1b

By James N Hitz

"Hello <?PHP World ?>"

Let's create a Hello World code in PHP. Gosh I have seen "Hello World" so many times I at times think it's my name. Let's be different. Let's say "Hello PHP World"

<html><head><title>Hello PHP World</title><head>
<body bgcolor="black" text="white">
<?php
  print("<h3>Hello PHP World</h3>");
?>
</body></html>

There are a few things worth noticing:

  1. the PHP code is embedded within HTML
  2. PHP code MUST be escaped. In our example we have escaped our PHP using the standard method discussed earlier.
  3. every PHP statement MUST end with a semi-colon (;). Java, Perl and JavaScript programmers are at peace with this
  4. You can output text to the browser using the print() statement.
  5. The text being output should be put within double quotes: "blah blah"
  6. "plain HTML" can be output within a print() statement
  7. Our code is indented. Yours doesn't have to be though. Just trying to be tidy inspite of me being... well.. me.

<< Escaping PHP from Perl | Ambitious Alternative >>