PHP for Beginners: Conditionals

Sep 20, 2011 | PHP Cheat Sheets | 0 Comments
Basic use of conditionals in PHP

Conditional statements are used to preform different actions based on different conditions. In PHP, there are four conditional statements: if – execute code only if a specefied condition is true, if…else – execute code if a condition is true and another code if the condition is false, if…elseif…else – select one of several blocks of code to be executed, and switch – select one of many blocks of code to be executed.