Conditional statement syntax is almost same as in other langauges
If condition syntax
if (condition) {
//Code to let user access the site here;
}
if else statement syntax
if(condition){
//code that should be executed if true
}else{
//code that should be executed if condition false
}
ifelse statement syntax
if(condition1){
//code
}elseif(condition2){
//code
}
Switch statement in php
switch(variable){
case ‘one’:
//code
break;
case ‘two’:
//code here
break;
default:
//default code here
break;
}
note: break statement is very important
Comments
Post a Comment