我有一个快速的问题,例如,如果Value大于PreviousValue的50,我该如何获得?到目前为止,我得到了以下代码:
$Value = 1000;
$PreviousValue = 900;
if ($Value > $PreviousValue) {
echo " has increased in price <br>";
}
我需要改变什么才能达到50以上?提前感谢
您需要指定要匹配的边距,在本例中为50
,即:
$previousValue = 900;
$currentValue = 1000;
$margin = 50;
if ($currentValue > $previousValue + $margin) {
echo " has increased in price <br>";
}