PHP Basics
I have been seeing a lot of post about learning php So I'll give some basics of php.
first you need a file called for example "index.php"
know for the php file to work you need to put this into it
<?php
?>
Ok Know we are going to make a basic call in your php file.
To start a basic syntax call it starts with $ sign. to enclose your value you can either use ' ' or " " know lets say your value text is hello it's me we in the word it's has a ' to void that value out you put \ this in front of ' this.
Know at the end of your syntax it has to have this ;
To print this value out you can either use print or echo to show your value out.
<?php
$hello = 'hello it\'s me';
echo $hello;
print $hello;
?>
So lets say you want to add a comment in your php file so you can come back to the file and read of what you doing you put this in front of your comment // for example.
<?php
// this is how to print out our syntax
$hello = 'hello it\'s me';
echo $hello;
print $hello;
?>
So when you combine them after the fist value your going to want to put this behind it . yes the period.
<?php
// this is how to print out our syntax
$name = ' and my name is joe';
$hello = 'hello it\'s me';
$hello_name = $hello.$name;
print $hello_name;
?>
hello it's me
and my name is joe
your syntax would look like this you can see after the . we wrapped some html code in it to break it and inclosed with " " and after that we put another . so thats how we do that
<?php
// this is how to print out our syntax
$name = 'and my name is joe';
$hello = 'hello it\'s me';
$hello_name = $hello."<br>".$name;
print $hello_name;
?>
if(){
}
this how it would look in the if statement
the equal
if($a == '1'){
}
if($a =! '1'){
}
<?php
$a = '1';
if($a == '1'){
$b = 'what i want to print if $a is equal to 1';
}
print $b;
?>
<?php
// this is how to print out our syntax
$diff_name = 'ted';
if($diff_name == 'ted'){
$user ='Ted';
}
if($diff_name == 'joe'){
$user ='Joe';
}
$name = 'and my name is '.$user;
$hello = 'hello it\'s me';
$hello_name = $hello."<br>".$name;
print $hello_name;
?>
Know with the if statement you can have a else statement with it .
What that means in word terms is this if $a is not equal to 1 else use the other option.
so the php code would look like this
<?php
$a = '1';
if($a == '1'){
$b = 'what i want to print if $a is equal to 1';
}else{
$b = 'what i want to print if $a is not equal to 1';
}
print $b;
?>
hear is a example:
<?php
// this is how to print out our syntax
$diff_name = 'ted';
if ($diff_name == 'ted'){
$user ='Ted';
} elseif ($diff_name == 'joe'){
$user ='Joe';
}else{
$user ='Noname';
}
$name = 'and my name is '.$user;
$hello = 'hello it\'s me';
$hello_name = $hello."<br>".$name;
print $hello_name;
?>
<?php
// this is how to print out our syntax
$diff_name = 'ted';
switch ($diff_name){
case 'ted':
$user ='Ted';
break;
case 'joe':
$user ='Joe';
break;
case 'erica':
$user ='Erica';
break;
default:
$user ='Noname';
}
$name = 'and my name is '.$user;
$hello = 'hello it\'s me';
$hello_name = $hello."<br>".$name;
print $hello_name;
?>
How To Build A Profitable Email List Within 24
Hours From RIGHT NOW! Click here.."
Source: friv
>> 72 Hour Special <<
Thanks & Regards,
Reach us at dukeduke600@gmail.com.
Web Design| Logo Design | Banner Design | Web Development | Mobile Applications [iPhone/iPad/Android/Windows Phone]
Freelancing jobs in india
Permanent Official Factory Unlock iPhone 4S, 4, 3GS, 3,and ANY Other AT&T iPhone *No JAILBREAK REQUIRED*
Including IN CONTRACT iPhones & Baseband 4.11.08 & 4.1201 ** Dirty Cheap ** Fastest Service Anywhere **
warriorforum.com