在这里完成 PHP noob 并返回错误,因为嵌套if
块很大。当我更改代码时,错误会有所不同,但它始终与if
语句有关。执行此语句的正确方法是什么?
这是不正确的if
块:
if(!empty($_GET['x2'])) and (!empty($_GET['x'])) and (!empty($_GET['num']))
{
$xsqrd = $_GET['x2'];
$x = $_GET['x'];
$num = $_GET['num'];
if(($xsqrd*2)==0.0)
{
print $errdivzero;
}
else if(sqrt(pow($x,2)-(4*$xsqrd*$num)))
{
print $errsqrtmin1;
}
else
{
$ans1 = (-$x)+(sqrt(pow($x,2)-(4*$xsqrd*$num)))/(2*$xsqrd);
$ans2 = (-$x)-(sqrt(pow($x,2)-(4*$xsqrd*$num)))/(2*$xsqrd);
}
}