我的 IF 语句有问题。为什么我的代码总是说a 不大于 b我做错了什么?即使数字更大,它也只是说不是?
<?php
//vars
$A = '454';
$B = '1001';
?>
<?php
function difference($val3, $val4)
{
$subtract = ($val3 - $val4);
return $subtract;
}
// random number generator function
function random($min, $max)
{
return rand($min,$max);
}
$ANum = random(1,$A);
$BNum = random(1,$B);
$difference = "-170"; //difference($teamANum, $teamBNum);
function result()
{
if ($ANum > $BNum)
{
echo "a is greater than b";
}
else
{
echo "a is NOT greater than b";
}
}
?>
<?php
echo "A: ".$teamANum."\n";
echo "B: ".$teamBNum."\n";
echo "Difference: ".$difference."\n";
echo result()."\n";
?>
谢谢