I'm having problems with my IF statement. Why does my code just always say that a is NOT greater than b what have I done wrong? Even when the number is greater it just says it's not?
<?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."
";
echo "B: ".$teamBNum."
";
echo "Difference: ".$difference."
";
echo result()."
";
?>
Thanks