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:
- the PHP code is embedded within HTML
- PHP code MUST be escaped. In our example we have escaped our PHP using the standard method discussed earlier.
- every PHP statement MUST end with a semi-colon (;). Java, Perl and JavaScript programmers are at peace with this
- You can output text to the browser using the print() statement.
- The text being output should be put within double quotes: "blah blah"
- "plain HTML" can be output within a print() statement
- 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 >>
|