我的if语句出了问题

时间:2017-10-23 13:18:30

标签: php forms

这就是我有问题的地方......当有人选择$ r并且当有人选择$ p时会显示“你有我的尊重”但是它保持打印“你有我的尊重”时,我希望这显示给我“你是个笑话” “无论哪种方式!

<?php
$r = ("silver"."bronze"."cooper");
$p = ("gold"."platinium"."diamond");
if($r == 'silver'.' bronze'.'cooper'){
    echo "You Are a Joke";
} elseif ($p == "gold"."platinium"."diamond"){
    echo "You Have My Respect";
} else {
    echo "Your Rank Is *** Bro";
}
?>

1 个答案:

答案 0 :(得分:0)

extra space移除' bronze',以便解决您的问题

 <?php
      $r = ("silver"."bronze"."cooper");
      $p = ("gold"."platinium"."diamond");
      if($r == 'silver'.'bronze'.'cooper'){ //remove extra space
         echo "You Are a Joke";
      } elseif ($p == "gold"."platinium"."diamond"){
         echo "You Have My Respect";
      } else {
         echo "Your Rank Is *** Bro";
      }
  ?>