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 »
Site içinde arama yapın
Kategoriler
Read More
Other
PHP - Escape Characters
Escape Character To insert characters that are illegal in a string, use an escape character. An...
By PHP Tutorial 2024-05-17 07:32:36 0 11K
Other
PHP if Statements
Conditional statements are used to perform different actions based on different conditions....
By PHP Tutorial 2024-05-17 07:45:23 0 4K
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
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
Sociallez https://sociallez.com