![]() |
||||||||||||||||||
| Home --- Topics --- Articles --- Offers --- Register --- Contact us | ||||||||||||||||||
|
|
||||||||||||||||||
|
Did you know? if you register at Hamid School you can save up to 45% on hosting packages offered by Surreyhost.com . Don't miss out, every minute counts! Are you Confused? Click here to learn how to use hamid school PHP If...Else StatementsThe if, elseif and else statements in PHP are used to perform different actions based on different conditions. Conditional StatementsVery often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.
The If...Else StatementIf you want to execute some code if a condition is true and another code if a condition is false, use the if....else statement. Syntax
ExampleThe following example will output "Have a nice weekend!" if the current day is Friday, otherwise it will output "Have a nice day!":
If more than one line should be executed if a condition is true/false, the lines should be enclosed within curly braces:
The ElseIf StatementIf you want to execute some code if one of several conditions are true use the elseif statement Syntax
ExampleThe following example will output "Have a nice weekend!" if the current day is Friday, and "Have a nice Sunday!" if the current day is Sunday. Otherwise it will output "Have a nice day!":
Viewed:438 Original Author: W3school however, some changes have been made to the main contents.
Did you know? if you register at Hamid School you can learn web programming and designing for free and also you can save up to 45% on hosting packages offered by Surreyhost.com . Don't miss out, every minute counts!
|
|
|||||||||||||||||
|
Sponsored by: Surreyhost.com Coded and designed by: Hamid Moudi HPLA Follow us: ![]() ![]() |
||||||||||||||||||