Home » , , » IF Statement in PHP

IF Statement in PHP

Written By Unknown on Senin, 14 Desember 2009 | 01.38

Conditional statements are used to perform different actions based on different conditions.


The IF statement is necessary for most programming, thus it is important in PHP. In PHP we have the following conditional statements.. They are
IF Statement - Use this statement to execute some code only if a specified condition is true.
IF ... ELSE Statement - Use this statement to execute some code if a condition is true and another code if the condition is false.
IF...ELSEIF...ELSE Statement - Use this statement to select one of the several blocks of code to be executed.
SWITCH Statement - use this statement to select one of many blocks of code to be executed.


IF Statement : 


Use this statement to execute some code only if a specified condition is true.


Syntax:
if (condition) 
           {
              code to be executed if condition is true;
           }


Example:


$d=date("D");
if ($d=="Fri") 
{
echo "Have a nice weekend!";
}

Share this article :

Posting Komentar

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Kumpulan Kata Broadcast Blackberry - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger