PHP Basics
In this tutorial we will help you understand how to use php.
Category: Coding
Views: 2000

PHP Basics Welcome to the php basics tutorial! In this tutorial we will help you understand how to use php.

First off, you need to know how to open php tags and close them.

Code:
Thats opening a tag.

Code:
?>
And thats closing a tag.

All you're php work goes inside those tags.
Now, if you want to print something onto the page you use this.
Code:
echo 'Hello world!';
?>
That would output the words Hello world.

Next we are going to create a variable.
Variable's hold data.
For example:
Code:
$variable = 'Hello world!';
echo $variable;
?>


As for checking we would use an if statement.
Code:
$one = 1;
$two = 2;
if($one==$two){
echo 'one is equal to two.';
}
else{
echo 'one is not equal to two.';
}
?>

what this does is it checks if the data in variable $one is the same as the data in variable $two.
If it was it would have output one is equal to two but because it isnt, the else statement returned one is not equal to two instead.

If you would like more help with this tutorial please register and visit the forum.

About Michael

Michael Dunlop Michael Dunlop personal statement

“But I am already older than 21”, I hear you cry. Don’t worry, despite the name, the information and advice is more geared towards retiring prior to having a fake hip installed.

Website Sponsors
Recommended Websites
They Buy, Build, Upgrade and Sell Websites.
 
Advertise Here
Feature Interviews
Graham went from $100 one day to ... Read more
Paul Bourque started affiliate marketing less than ... Read more
Interview with Yaro Starak of Entrepreneurs-Journey.com is ... Read more
Recommended Resources
 
 
 
 
 
Get Retire at 21's FREE Secrets
Find out how I'm going to Retire VERY Early Subscribe for my Free Secrets Privacy Guaranteed. 100% Spam free.