PHP Nested if Statement

0
2Кб

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 »
Поиск
Категории
Больше
Другое
PHP Syntax
A PHP script is executed on the server, and the plain HTML result is sent back to the browser....
От PHP Tutorial 2024-05-17 07:10:53 0 4Кб
Другое
PHP - Slicing Strings
Slicing You can return a range of characters by using the substr() function. Specify...
От PHP Tutorial 2024-05-17 07:31:23 1 4Кб
Другое
PHP Constants
Constants are like variables, except that once they are defined they cannot be changed or...
От PHP Tutorial 2024-05-17 07:39:53 0 4Кб
Другое
PHP Loops
In the following chapters you will learn how to repeat code by using loops in PHP. PHP Loops...
От PHP Tutorial 2024-05-17 07:48:35 0 2Кб
Другое
PHP while Loop
The while loop - Loops through a block of code as long as the specified condition is...
От PHP Tutorial 2024-05-17 07:48:58 0 2Кб