Login |  Register 
Secure your virtual life!
Your Developer Exam showed me just how much there is to PHP.
Ross
 

Basic control statements

The most basic control statement is the IF statement which if some condition is true will execute a section of code. So
if ($count == 10)
{
   echo "Test complete"
}
This will print "Test complete" on the screen, when the variable count reaches 10. The IF statement can be extended by using a ELSE statment. The code in the else block will only execute when the IF statement is false. So..
$count = 5;
if ($count == 10)
{
   echo "Test complete"
}
else
{
   echo "Test else"
}
This will print Test else to the screen.

Comments to date: 1. Page 1 of 1. Average Rating:
Suraj   1:02pm on Thursday, April 1st, 2010 
MY BOOK IS PHP ROCKS

security image
Written by Dominic Skinner
Last Updated: 2009-05-21 08:16:07