Syntax error Display game is in BUY or TRY mode PHP conditions?

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: 2020-10-13T07:07:44+05:30

75 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements