"Welcome to our PHP 101 blog, where we demystify the world of web development. "

Friday, January 19, 2024

PHP Nested If

 Nested If

You can have if statements inside if statements, this is called nested if statements.


Example: 

<?php 

$a = 13;

if ($a > 10) {

  echo "Above 10";

  if ($a > 20) {

    echo " and also above 20";

  } else {

    echo " but not above 20";

  }

}

?>

Output:



No comments:

Post a Comment

Pages

SoraTemplates

Best Free and Premium Blogger Templates Provider.

Buy This Template