Monday 7 November 2011

If and Else Statement

The if and else statements can be very helpful in controlling the power and resulting output of your scripts.You can input your site with basically unlimitited possibilities.You can diffrent massage based on different content or persone's.

EXAMPLE OF CODE

$ages=45;
if($ages=1 && $ages<=4){
echo "Infant";
}else if($ages=5 && $ages<=12){
echo "child";
}else if($ages=13 && $ages<=19){
echo "Teen";
}else if($ages=20 && $ages<=40){
echo "Youth";
}else if($ages=41 && $ages<=60){
echo "adult";
}else{
echo "Enter correct value";
}
?>

No comments:

Post a Comment