PHP Nested if Statement

0
3 الف

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 Add Array Items
Add Array Item To add items to an existing array, you can use the bracket [] syntax....
بواسطة PHP Tutorial منذ ٩ أشهر 0 5 الف
أخرى
PHP Arrays
An array stores multiple values in one single variable: ExampleGet your own PHP Server $cars...
بواسطة PHP Tutorial منذ ٩ أشهر 0 4 الف
أخرى
PHP Variables Scope
PHP Variables Scope In PHP, variables can be declared anywhere in the script. The scope of a...
بواسطة PHP Tutorial منذ ٩ أشهر 0 6 الف
أخرى
PHP echo and print Statements
With PHP, there are two basic ways to get output: echo and print. In this...
بواسطة PHP Tutorial منذ ٩ أشهر 0 5 الف
أخرى
PHP Variables
Variables are "containers" for storing information. Creating (Declaring) PHP Variables In...
بواسطة PHP Tutorial منذ ٩ أشهر 0 4 الف