为什么在PHP if语句中会出现这种解析错误?

为什么在PHP if语句中会出现这种解析错误?,php,parse-error,control-structure,Php,Parse Error,Control Structure,我得到这个错误: 分析错误:语法错误,意外“!=”T_在第131行的C:\xampp\htdocs\assurance\confirmation.php中不相等 下面是我的代码的第131-134行: if ($_POST['password']) != ($_POST['confirm']) { echo '<p class="error">Your passwords do not match.</p>'; $okay = FALSE; } 请参见使用此 if (

我得到这个错误:

分析错误:语法错误,意外“!=”T_在第131行的C:\xampp\htdocs\assurance\confirmation.php中不相等

下面是我的代码的第131-134行:

if ($_POST['password']) != ($_POST['confirm'])  { 
echo '<p class="error">Your passwords do not match.</p>';
$okay = FALSE;
}
请参见使用此

if ($_POST['password'] != $_POST['confirm'])  { 
    echo '<p class="error">Your passwords do not match.</p>';
    $okay = FALSE;
}

去掉多余的括号。您的代码应该是:if$\u POST['password']!=$_发布['confirm']。如果$u发布['password']!=$_要求代码的POST['confirm']问题必须表明对正在解决的问题的最低理解。包括尝试过的解决方案、它们不起作用的原因以及预期结果。
if (expr)
  statement
if ($_POST['password'] != $_POST['confirm'])  { 
    echo '<p class="error">Your passwords do not match.</p>';
    $okay = FALSE;
}