PHP Nested if Statement

0
4K

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 »
Cerca
Categorie
Leggi tutto
Altre informazioni
PHP Multidimensional Arrays
In the previous pages, we have described arrays that are a single list of key/value pairs....
By PHP Tutorial 2024-05-17 08:07:20 0 7K
Altre informazioni
PHP switch Statement
The switch statement is used to perform different actions based on different...
By PHP Tutorial 2024-05-17 07:47:56 0 4K
Altre informazioni
PHP while Loop
The while loop - Loops through a block of code as long as the specified condition is...
By PHP Tutorial 2024-05-17 07:48:58 0 4K
Altre informazioni
PHP if...else Statements
PHP - The if...else Statement The if...else statement executes some code if a...
By PHP Tutorial 2024-05-17 07:46:12 0 4K
Altre informazioni
PHP Constants
Constants are like variables, except that once they are defined they cannot be changed or...
By PHP Tutorial 2024-05-17 07:39:53 0 8K
Sociallez https://sociallez.com