The If Construct:
The if construct is present in most of the famous computer languages, PHP uses the if construct to check the execution of code fragments. The if structure in PHP is similar to theExample:
<?php
$a
=34;$b
=45;if
($a<$b)echo"\$a is smaller";?>
Output:
$a is smaller
Example:
<?php
$a
=34;$b
=34;if
($a<$b)echo"\$a is smaller<br/>";if
($a>$b)echo"\$a is bigger<br/>";if
($a==$b)echo"\$a is equal to \$b<br/>";?>
Output:
$a is equal to $b
Example:
<?php
$a
=34;$b
=3;$c
=45;if
($a>$b){
if($a>$c) echo "\$a is greatest";}
if
($b>$a){
if($b>$c) echo "\$b is greatest";}
if
($c>$a){
if($c>$b) echo "\$c is greatest";}
?>
Output:
$c is greatest
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.