Blog Introductions
In this blog contains tutorials about HTML Tutorials, Python Tutorials, CSS Tutorials, How to, PHP Tutorials, Java Tutorials, C++ Tutorials, Tutorials, Examples, Source code,Learning,
Tips and Software development services. Php controls flow if-else statements | Php tutorials Bestitworriors
Php controls flow if-else statements
Php controls flow if-else statements | Php tutorials Bestitworriors - Php controls flow used to execute code on specific condation . Execute code on when that condation match with certein criteria.This piece of code is use to execute if certain given condation is matches.if(contation ==condation) // Execute certain pice of code.The if-else control flow of code with respect to condation if a first condation is don't match the it will execute the else{//code} part . You can use multiple if-else controls in regular flow . One more condation can be use is else-if .
Some Key Points of if-else
- Php if-else use to control the code
- if-else use in if some condational code occure
- if a first condation don't match code execute the else part
- You can use else-if condation too
- You can have multiputle if-else or else-if in your code
- Mostely use to control the flow in order to certein condation
Code
<?php
$value1=10;
$value2=20;
if ($value1<$value2) {
echo "First variabel is smaller then Second";
echo "<br>";
}
if ($value1>$value2) {
echo "First variable is greater the second";
echo "<br>";
}
else {
echo "First variable is smallar then second";
echo "<br>";
}
if ($value1==$value2) {
echo "Both variables are equal";
echo "<br>";
} elseif ($value1 < $value2) {
echo "First Variable is smallar the Second";
echo "<br>";
} else {
echo "First Variable is Greater then Second";
echo "<br>";
}
?>
OutPut
First variabel is smaller then Second
First variable is smallar then second
First Variable is smallar the Second
First variable is smallar then second
First Variable is smallar the Second
0 Comments