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 »
Pesquisar
Categorias
Leia Mais
Outro
PHP Variables Scope
PHP Variables Scope In PHP, variables can be declared anywhere in the script. The scope of a...
Por PHP Tutorial 2024-05-17 07:18:52 0 10K
Outro
PHP - Modify Strings
PHP has a set of built-in functions that you can use to modify strings. Upper Case...
Por PHP Tutorial 2024-05-17 07:29:19 0 8K
Outro
PHP Operators
PHP Operators Operators are used to perform operations on variables and values. PHP divides the...
Por PHP Tutorial 2024-05-17 07:41:39 0 9K
Outro
PHP Casting
Sometimes you need to change a variable from one data type into another, and sometimes you want a...
Por PHP Tutorial 2024-05-17 07:38:02 0 4K
Outro
PHP Functions
The real power of PHP comes from its functions. PHP has more than 1000 built-in functions, and...
Por PHP Tutorial 2024-05-17 07:53:06 0 4K
Sociallez https://sociallez.com