| Ajax Tutorials, PHP Tutorials, Javascript Tutorials, Visual Basic.Net Training, XHTML tutorials, php script library, PHP Codes, Programming tutorials, web development tutorials | ||||||||
![]() |
||||||||
| Home | Forums | Downloads | Books | Submit Content | Links | ||||||||
Conditional StatementsDate:2006-02-13Conditional statements are most often used to compare two or more value either true or false. conditional statements are used with comparison and logical operators. There are two types of conditional statements: If Statement If statement is very famous statement in PHP and other programming languages. This statement is used when a condition is true and another condition is false Syntax
Example
In this code you can see if $a variable equal to $b then show output "values are not equal" otherwise executes else statement ("values are false"). You can also use other comparison operators as well as you can use if .. else statement with logical operators
This example displays multiple if else statements
Switch Statement If statement can contain as many elseif clauses as you need, but including many of these clauses can often create complex code, alternative is of if else statement is available. switch is a conditional statement that can have multiple branches in a much more compact format.
Example
Note: For better understanding, practices if else statement with all comparison and logical operators, then you can better understand. |
|
|||||||
| Desclaimer | Privacy Policy | Submit Content | Links | Link to Us | Sitemap |Contact Us | ||||||||
| Copyright Programming Tutorials, Web Development
Tutorials, Source codes © All Rights are Reserved. Powered By Evernew Solutions Phoenix Landscaping - Credit Counseling - Internet Marketing - Bad Credit Loans |
||||||||