Welcome to Zortin.com

Homepage
Fav.  |  About  |  G. search  |  Keywords  |  Blog

Search for
Click here for a great link





CODES  All Codes »
GENERATORS ---------------- All Generators »
SCRIPTS  Latest Scripts »
LAYOUTS & GRAPHICS
TOOLS  All Tools »
TUTORIALS  Latest Tutorials »
LESSONS

Easy PHP Tutorial
Easy PHP tutorial


PHP is a very interesting and easy computer language
You are propably thinking, how can i manage to learn PHP, it seems like a long process!
However, this tutorial will make it easy for you

You dont even need to know HTML, however, HTML will help you work the PHP better

So, let us make a start
There is no need to even mention what does PHP stand for, let us just get crackin!

All PHP codes must be written like that


All the codes go in-between these two PHP tags as shown above

Now, lets mention where do you write all that stuff, i.e. where do you write your PHP codes
easier than you think...
Simply open a new text document
i.e. Right click with your mouse, then Create a new text document
then rename it to: try
So, now you should have a text document which is called try

Note that the text document you just created is not php, it is a simple .txt document
That is not right, so, in order to make it a php document, you will follow the following easy steps
open this try document you just created
then go to File > save as > and save it in any folder in your computer but give it this name "try.php"
You have to include the " " bits, as this will save the text document as a php document

The reason this must be done is because if you uploaded the text document in your server and then opened it, the PHP codes will not show, this is because the document is a text document,
Therefore, now that you have a try.php document, this will work fine
If your tried to open the document, and your Computer asks you what program should you use, simply choose text document

Before we start creating some codes, you now must have a php document called try saved somewhere in your computer, this document has a php exptension
so, it is called try.php and not try.txt

1) VARIABLES:

Variables are very interesting and it is a good way to start learning PHP by learning variables
Propably now you are thinking, here we go, the confusing names just began
But variables are easy
The variable starts with a dollar sign
so, lets make a variable called 'name'
the variable will be like that:
$name
now that we have a variable called name, we can give it a value
so, we can give the variable $name a value John
this can be written like that


The above PHP code means that $name is John
Notice the ; at the end of the line, this is very important in PHP
The reason that ; is used, is because it tells that the line has ended
If it was not used at the end of any line, a PHP error will propably show up
It is important to remember that the line must end with ;

Now, the next step is to use echo or print
they are very imporant in PHP
they are used to show something

Lets say that you wish to display the value of the variable $name
The way to do this is...
print "$name";

The code will therefore look like that



TO BE CONTINUED...