PHP Nested if Statement

0
2K

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
الثورة البلوكتشين وتحولاتها في الصناعات المختلفة
مقدمة: شهدت تقنية البلوكتشين ثورة هائلة في السنوات الأخيرة، حيث أصبحت لديها القدرة على تغيير...
By MOHAMED ATTALLAH 2024-05-14 14:03:03 0 4K
Other
PHP if...else Statements
PHP - The if...else Statement The if...else statement executes some code if a...
By PHP Tutorial 2024-05-17 07:46:12 0 2K
Other
PHP do while Loop
The do...while loop - Loops through a block of code once, and then repeats the loop as...
By PHP Tutorial 2024-05-17 07:49:22 0 2K
Other
PHP Data Types
PHP Data Types Variables can store data of different types, and different data types can do...
By PHP Tutorial 2024-05-17 07:27:24 0 3K
Other
PHP Introduction
PHP code is executed on the server. What You Should Already Know Before you continue you...
By PHP Tutorial 2024-05-17 07:08:40 0 3K