PHP Nested if Statement

0
4KB

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 »
Suche
Kategorien
Mehr lesen
Andere
PHP Syntax
A PHP script is executed on the server, and the plain HTML result is sent back to the browser....
Von PHP Tutorial 2024-05-17 07:10:53 0 8KB
Andere
PHP Numbers
In this chapter we will look in depth into Integers, Floats, and Number Strings. PHP Numbers...
Von PHP Tutorial 2024-05-17 07:37:05 0 6KB
Andere
PHP Shorthand if Statements
Short Hand If To write shorter code, you can write if statements on one line....
Von PHP Tutorial 2024-05-17 07:47:03 0 4KB
Andere
PHP echo and print Statements
With PHP, there are two basic ways to get output: echo and print. In this...
Von PHP Tutorial 2024-05-17 07:20:06 0 8KB
Andere
PHP Add Array Items
Add Array Item To add items to an existing array, you can use the bracket [] syntax....
Von PHP Tutorial 2024-05-17 08:06:05 0 7KB
Sociallez https://sociallez.com