PHP If Statements – Making Decisions PHP Tutorial

PHP If Statements can help you make decisions in code. I figured before I jump into the shopping cart, I should show you how to use if else statements which are common among many programming languages PHP included. They include if, else, and else if. I will share examples for each case and finally touch on switch statements and Arrays in this php tutorial.
php if statements

PHP if Statements

[php]
#Conditional statements are used to make decisions in programs
#Here is the skeleton:
<?php
if (condition){
//do something
}else{
//do something else
}
?>
#Let me drive this point home a little easier!
<?php
if (your electric bill is due){
//go pay your bill pal
}else{
//don’t worry about it, just enjoy the light
}
?>