The if…elseif…else a special statement that is used to combine multiple if…else statements. The following example will output “Have a nice weekend!” if the current day is Friday, otherwise it will output “Have a nice day!” Code to be executed if condition is false Code to be executed if condition is true The if…else statement allows you to execute one block of code if the specified condition is evaluates to true and another block of code if it is evaluates to false. You can enhance the decision making process by providing an alternative choice through adding an else statement to the if statement. If is a conditional statement which is used in all major programming languages.The if statement in PHP used when we deal with the conditions. If securty is enabled, only PHP functions from phpfunctions. The following example will output “Have a nice weekend!” if the current day is Friday: All PHP conditionals and functions are recognized, such as, or, &, and, isarray(), etc. This is the simplest of PHP’s conditional statements and can be written like:Ĭode to be executed if condition is true The if the statement is used to execute a block of code only if the specified condition evaluates to true. There are several statements in PHP that you can use to make decisions: This means you can create test conditions in the form of expressions that evaluates to either true or false and based on these results you can perform certain actions. Like most programming languages, PHP also allows you to write code that performs different actions based on the results of logical or comparative test conditions at run time.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |