PHP Nested if Statement

0
4كيلو بايت

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 Casting
Sometimes you need to change a variable from one data type into another, and sometimes you want a...
بواسطة PHP Tutorial 2024-05-17 07:38:02 0 4كيلو بايت
أخرى
PHP Sorting Arrays
The elements in an array can be sorted in alphabetical or numerical order, descending or...
بواسطة PHP Tutorial 2024-05-17 08:06:46 0 8كيلو بايت
أخرى
PHP Indexed Arrays
PHP Indexed Arrays In indexed arrays each item has an index number. By default, the first item...
بواسطة PHP Tutorial 2024-05-17 08:00:38 0 6كيلو بايت
أخرى
PHP switch Statement
The switch statement is used to perform different actions based on different...
بواسطة PHP Tutorial 2024-05-17 07:47:56 0 4كيلو بايت
أخرى
PHP Continue
The continue statement can be used to jump out of the current iteration of a loop, and...
بواسطة PHP Tutorial 2024-05-17 07:52:32 0 4كيلو بايت
Sociallez https://sociallez.com