Display game is in BUY or TRY mode PHP conditions?

PHPServer Side ProgrammingProgramming

For such conditional evaluation, use PHP if(), else if() and else.

Example

The PHP code is as follows

 Live Demo

<!DOCTYPE html>
<html>
<body>
<?php
   $gameMode="BUY";
   if($gameMode=="TRY")
      echo "GAME IS IN ",$gameMode," MODE","<br>";
   else if($gameMode=="BUY")
      echo "GAME IS IN ",$gameMode," MODE","<br>";
   else
      echo "GAME IS NEITHER TRY NOR BUY MODE","<br>";
?>
</body>
</html>

Output

GAME IS IN BUY MODE
raja
Updated on 13-Oct-2020 07:07:44

Advertisements