Everyday the world wide web(WWW) keeps getting more advanced, people thinking of new ways to produce top quality products for Gamers/Programers Clients and More.
In this tutorial, i will/try to explain the basics behind Php.
This tutorial will cover:
- Introducing Php
- What you will Need
- Getting Started
- Your first script
- Variables
- Operators
Introducing Php
Php is a server side scripting language, that Coders use to execute .php scripts to create websites.
Php can create a wide veriety of things like, Textbased/2D game engines, social Networks like Facebook,Twitter and Myspace, Filesharing websites like rapidshare, Forums like Dreamincode or bethesda forums.
Some people can use php to create there own encryption algorithms like the md5 hash.
You DO Need a server to execute the php scripts though.
Php Stands for Php:Hypertext[/b] P[/b]reProcessor.
What you will Need
To execute your php scripts, you will need a server to execute them on, i suggest (if you dont have a server alreadey) you use wamp server.
Wamp server Is a free,easy to use server, i use it because its smaller than downloading all the Php/Apache/Mysql
programs, and it come configured, so no fidleing around
You might also want to use an WYSIWYG editor - i use zend studio, but you can use witch ever one you wish.
Getting Started
If you have completed the What you will Need Step, then run the installer(s), and configure as you please.
Open your WYSIWYG editor and click "Save As" and save it as - "myfirstscript.php" Remember the ".php" bit, because, you have to have it or the editor will not save it as a php script.
Ok, We're done here, lets move on to the exciting stuff shall we.
My First Script
<?php echo "Hello World!"; ?>
What is that you say, well it's one of the simplest scripts written in php.
Lets go through the above script.
- <?php - This tells the compiler that the script is belongs to the Php languge.
- echo "Hello World!"; - This will display Hello world! onto your screen.
- ?> - This tells the server to end the php script
Was that simple, i hope it was easy to understand.
So, You have just learnt ho to make your own php script.
Easy, Bah, nothing to it once you get the hang of it =]
Variables
Do you remeber algebra from school, and thinking "Were in life would i use that".
Well in php is were. Some websites revolve around equations and algorithms.
well php uses things called variables, witch scripts store things in.
variables are defined by the dollar sign "$".
Say for example,
<?php $x = 1; ?>
The code above makes a new variable called "i" witch we had just stored the number 1 to.
You can store mostley everything you want in variabls, from numbers,strings(abc),arrays,sql queries and functions.
So lets try this one aye
<?php $string = "My name is"; $name = "Aaron"; $final = $string . " " . $name; echo $final; ?>
The above code will output "My name is Aaron".
This uses a function known as concatenation
This will join the $string variable with the $name variable.
what You've learnt
I hope you have been listening =] because you will eaither come across variables sooner or later.
Operators
Operators are signs that php use to determine things.
For example, = means equal to
- = - Equal To
- ! - Is Not
- < - Is lower than
- > - Is higher than
- || - Or
- && - and
- != - Is Not equal to
- <= is lowerthan or equal to
- >= - Is
What you have learned
You should have learnt, most of the php operators, that evolve around php
In the next tutorial you will learn:
- Functions
- Switch functons
- If - Statement
- If - Else - statement
- If - elseif - else
- While Loops
thanks for listerning, i hope you have learnt some new things that you might not or did not know.
Thanks Aaron1178







MultiQuote





|