This will be a really easy starter tutorial and will go over how to create a Hello World PHP application. I'll be doing a few of these easy starter tutorials then grow from there. We'll be doing PHP, Python & Ruby on Rails. So let's get started with PHP. I'm assuming you already have PHP installed.
Whatever text editor you use; type this data into the file.
<html>
<head>
<title> 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 :
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.