PHP Nested if Statement

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 »
Căutare
Categorii
Citeste mai mult
Alte
PHP Delete Array Items
Remove Array Item To remove an existing item from an array, you can use...
By PHP Tutorial 2024-05-17 08:06:22 0 4K
Alte
PHP for Loop
The for loop - Loops through a block of code a specified number of times. The PHP...
By PHP Tutorial 2024-05-17 07:49:43 0 2K
Alte
PHP Continue
The continue statement can be used to jump out of the current iteration of a loop, and...
By PHP Tutorial 2024-05-17 07:52:32 0 2K
Alte
PHP Access Arrays
Access Array Item To access an array item, you can refer to the index number for indexed arrays,...
By PHP Tutorial 2024-05-17 08:02:32 0 5K
Alte
PHP Array Functions
PHP Array Functions PHP has a set of built-in functions that you can use on arrays....
By PHP Tutorial 2024-05-17 08:07:42 1 5K