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 »
Zoeken
Categorieën
Read More
Other
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 8K
Other
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
Other
PHP Shorthand if Statements
Short Hand If To write shorter code, you can write if statements on one line....
By PHP Tutorial 2024-05-17 07:47:03 0 4K
Other
PHP Global Variables - Superglobals
Superglobals were introduced in PHP 4.1.0, and are built-in variables that are always available...
By PHP Tutorial 2024-05-17 08:08:10 0 10K
Other
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 4K
Sociallez https://sociallez.com