nested if else in php

Nested if else in php has slightly different syntax from c++. Here is an example:

<!doctype html>
<meta charset="utf-8">
<title>Untitled Document</title>



if($a > $b)
  echo "a is greater than b";	
elseif($a == $b)
  echo "a is equal to b";
  echo "a is smaller than b";

Looking carefully, we can see it is “elseif” rather than “else if” in php

Add a Comment

Your email address will not be published. Required fields are marked *