-1

我需要你的帮助来弄清楚如何将多个 if 语句与不同的条件结合起来。下面是我试图开始工作的代码。

<p><?php
     $age="25";
     $ID="prog5";

     if($age >= "16" && $age <= 32 && $ID == prog5) {
         print "Welcome to the Future of Systems";
     }
     else {
         print "Sorry, your ID isn't recognized by sync. Please click here for further  assistance.";
     }
?></p>

我希望仅当$age介于 16 和 32 之间且 if $IDis时才显示语句“欢迎来到系统的未来” prog5,但我使用的表达式不起作用。

4

1 回答 1

1

像这样更改您的 if 语句

简而言之,字符串文字由引号分隔:

if($age>=16 && $age<=32 && $ID=="prog5")
于 2014-10-18T09:03:47.283 回答