-1
只是試圖獲得一個簡單的if ... else語句來工作。最初,我們得到:只需要一個簡單的if ... else語句來工作
<?php
$IntVariable = 75;
($IntVariable > 100) ? $Result = '$IntVariable is
greater than 100'
: $Result = '$IntVariable is less than or equal
to 100';
echo "<p>$Result</p>";
?>
這需要變成一個if ... else語句。到目前爲止,我已經寫了:
<?php
$IntVariable = 75;
if ($IntVariable > 100) {
$Result = '$IntVariable is greater than 100';
}
else {
$Result = '$IntVariable is less than or equal to 100';
}
else {
echo "<p>$Result</p>";
}
?>
我真的新到PHP所以我可能失去了一些東西很簡單......
你有兩個else語句。 – RSon1234
如果你要使用許多其他語句,你應該使用elseif – fizzi