|
Developers ::
PHP
Resources :: Hello World Example
By Tom Fitzgerald
Welcome to your first program
created using PHP. Every great journey begins
with a first step so here it is.
Create the
document
First thing we will do is create
a new document and name it test.php, you can
create this file using your favorite html
editor or even using Windows notepad.
Whatever program you use; type
this data into the file.
<html>
<head>
<title>CCE's PHP
Tutorial</title>
</head>
<body>
<p>This is only a test</p>
<?php
echo "<p>...from PHP</p>";
?>
</body>
</html>
Save it as test.php, then upload
it to your web server.
Access the web site in your web
browser and you should see the following
output:
This is only a test
...from PHP
And there you have it! Easy
wasn't it?
Line by Line
Explanation
Basically the only line that
has to do with PHP is the one that says :
<?php
echo "<p>...from PHP</p>";
?>
The <?php part means to start
interpreting the following as PHP not HTML. The
echo "<P>...from
PHP</p>"; means to echo (display)
the code <p>...from
PHP</a> which of course is
standard HTML. The quotes are necessary as the
trailing ; to show the end of the line.
Contact Us for
further information
|