PHP Introduction
Welcome to the PHP Introduction by Clookid!
After reading this tutorial you will know: - how to start a PHP document.
- what PHP stands for.
- what PHP actually is.
- the echo function.
- how to end a PHP document.
- how to embed a PHP document into an HTML document.
Before starting this tutorial you should know: PHP stands for Hypertext Preprocessor and is used for web scripting.
First of all I am going to introduce an example and tell you what the output is; I will secondly tell you what each line does and then close off this tutorial.
Here is the example:
Example 1-1:
Code:
<?php
echo "Hello, I am an echo function!";
?>
The above example will output the following:
Hello, I am an echo function!
Make sure that you don't think that PHP is the next generation of Maths or whatever subject you struggle with, because really it isn't. It is so easy but gradually gets a little bit harder.
Also here's another thing, don't think of PHP as a big scary language, just think of it as HTML with some really helpful functions.
Line 1:
<?php is just introducing you to the PHP document, simple!
Line 2:
This here is the echo function, to write one of your own just replace the text surrounded by quotes, don't forget the semicolon though!
Line 3:
?> is just closing off your PHP document.
Here is that exact same example again except this time it is embedded into an HTML document:
Example 1-2:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Echo Function</title>
</head>
<body>
<?php
echo "Hello, I am an echo funtion!";
?>
</body>
</html>
Make sure that you do not get mixed up with HTML when doing PHP.
Eg. do not use <?php> or <php> when starting off your document.
Thank you for reading this tutorial, make sure you start memorising the functions that I taught you in this guide.
You must have authors permission to use this tutorial!