Nested IF Structure in PHP
By S.Tanveer
Published: 14 Aug 2004
Transfer of Control In PHP
Nested IF Structure in PHP
Nested IF Structure means when one IF statement is placed in The body of other IF statement then it is called Nested IF Structure. In PHP IF and ELSEIF statement is used for this purpose.
Syntax:
{ statments ; } elseif (different condition) { Statments ; } else { statments } ?>
Lets take an example to understand this structure. Take a number and decided that Numbre is +ve or -ve or zero.
0) { echo "Number is +ve" ; } elseif ($number < 0) { echo " Number is -ve "; } else { echo "Number is Zero"; } ?>