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 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 Comments
Comments in PHP A comment in PHP code is a line that is not executed as a part of the program....
By PHP Tutorial 2024-05-17 07:14:49 0 6K
Altre informazioni
PHP Syntax
A PHP script is executed on the server, and the plain HTML result is sent back to the browser....
By PHP Tutorial 2024-05-17 07:10:53 0 8K
Altre informazioni
PHP Casting
Sometimes you need to change a variable from one data type into another, and sometimes you want a...
By PHP Tutorial 2024-05-17 07:38:02 0 4K
Altre informazioni
PHP do while Loop
The do...while loop - Loops through a block of code once, and then repeats the loop as...
By PHP Tutorial 2024-05-17 07:49:22 0 4K
Sociallez https://sociallez.com