PHP Nested if Statement
Posted 2024-05-17 07:47:26
0
2K
Nested If
You can have if
statements inside if
statements, this is called nested if
statements.
ExampleGet your own PHP Server
An if
inside an if
:
$a = 13;
if ($a > 10) {
echo "Above 10";
if ($a > 20) {
echo " and also above 20";
} else {
echo " but not above 20";
}
}
Try it Yourself »Search
Categories
- Art
- Causes
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Games
- Gardening
- Health
- Home
- Literature
- Music
- Networking
- Other
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness
Read More
PHP Shorthand if Statements
Short Hand If
To write shorter code, you can write if statements on one line....
PHP Functions
The real power of PHP comes from its functions.
PHP has more than 1000 built-in functions, and...
PHP Nested if Statement
Nested If
You can have if statements inside if statements, this is...
PHP foreach Loop
The foreach loop - Loops through a block of code for each element in an array or each...
PHP - $_SERVER
$_SERVER
$_SERVER is a PHP super global variable which holds information about headers,...