PHP | if else if ladder | Find maimum among 3 using if else ladder | elseif keyword

preview_player
Показать описание
In this video you will learn about if else ladder statement in php. We will also write a php script to find out maximum among 3 elements.

if else if ladder in PHP
In if else ladder we use several if else statements together. In if else if ladder we write if(condition) immediate with the else keyword. It is also used when we need to make decision according to multiple condition. Its syntax appears like a ladder, so it is called as if else if ladder.
if (condition)
{ statements;
}
else
if(condition)
{ statements;
}
else
if(condition)
{ statements;
}
else
{ statements;
}

Note: observe the syntax carefully, you will find that a if condition is only checked when all of its previous if conditions are false, except the first if. When all if conditions are false then last else part will be executed. The last else is optional, if we need not to run any statements when all conditions are false then we can remove/discard it.
Note: In php you can use elseif instead of else if as elseif is also a keyword in php.

Learn C Language from beginning

Learn C++ from beginning

Learn Java from beginning

Learn Python from beginning

Learn PHP from beginning

#tarunsir #phptutorial #learnprogramming #php #ifelse #condition #ladder
Рекомендации по теме
welcome to shbcf.ru