Display game is in BUY or TRY mode PHP conditions?


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

Updated on: 13-Oct-2020

36 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements