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 »Zoeken
Categorieën
- Art
- Causes
- Crafts
- Dance
- Drinks
- Film
- Fitness
- Food
- Spellen
- Gardening
- Health
- Home
- Literature
- Music
- Networking
- Other
- Party
- Religion
- Shopping
- Sports
- Theater
- Wellness
Read More
PHP - Concatenate Strings
String Concatenation
To concatenate, or combine, two strings you can use...
PHP if Operators
Comparison Operators
If statements usually contain conditions that compare two values....
PHP Global Variables - Superglobals
Superglobals were introduced in PHP 4.1.0, and are built-in variables that are always available...
PHP Shorthand if Statements
Short Hand If
To write shorter code, you can write if statements on one line....
PHP foreach Loop
The foreach loop - Loops through a block of code for each element in an array or each...