Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

PHP Nested if

Nested If

You can place if statements within other if statements, which are known as nested if statements.

Example

An if statement within another if statement:

$a = 13;
if ($a > 10) {
 echo "Above 10";
 if ($a > 20) {
    echo " and also above 20";
 } else {
    echo " but not above 20";
 }
}