#1 - Learning PHP - Lesson #1

(1/1)

Richard Marks:
The first in a series of PHP lessons that I am writing while tutoring a friend.

PHP is used in a text file between opening and closing tags.

The opening tag is a < then ?php

The closing tag is a ? then a >

When I have to use these in my tutorials, I'll mark them as #OT# #CT# for opening tag, and closing tag. This is due to the way that this forum handles posted php code. I hate the way it colorizes it.
So I'm using alternative tags from here on out.

This is a very simple program that prints the words "Hello World!" on the page.

Create a new file in notepad called helloworld.php and place the following code in it.

Don't forget to use the correct opening and closing tags surrounding it.

Code:

#OT#
echo("Hello World!");
#CT#


Save the file, and upload the file to a web server that supports PHP code.

When you browse to the php file using your web browser, you should see "Hello World!" on the page.

Navigation

[0] Message Index