Use IF condition in PHP with Syntax and example from starting

Syntax of If Condition :

If (condition)

  {

  Write code here to be executed if condition is true;

  }

 

Ques:- Find the highest of two given numbers

 

Solution:-↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

<?php
$first_number=10;
$second_number=50;

echo "First number is= $first_number";
echo "<br />";
echo "Second number is= $second_number";
echo "<br />";

if($first_number<$second_number)
{
echo"$first_number is Smaller than $second_number";
}
else
{
echo" $first_number is Larger than $second_number ";
}

?>

 

 Check Result

No comments:

Post a Comment