新价值必须更大,更不同

I'm trying to compare the value entered by user ($b) with another value which is retrieved from my database tables ($a).

In theory, the below code should retrieve error 1 but it's not. Can you please help me understand what I'm doing wrong?

{$a=array('54607');
$b=array('54606');

if($a < $b){
   echo "error 1";
}elseif($a == $b){
   echo "error 2";
}else{
   echo "TRUE";
}

P.S. I'm a newbie in PHP so please be gentle and sorry in advance for any silly questions I may have.

$a=54607;
$b=54606;

if($a < $b){echo "error 1";
}elseif($a == $b){echo "error 2";
}else{echo "TRUE";}

If you're willing to print error 1 change your condition to a > b.

You should remove these array notation and define these as simple variables.

$a = 54607;
$b = 54606;

if ($a > $b) {
   echo "error 1";
} elseif($a == $b) {
   echo "error 2";
} else {
   echo "TRUE";
}

In case these has to be made arrays, use current() function:

$a = array('54607');
$b = array('54606');
if (current($a) > current($b)) {
   echo "error 1";
} elseif(current($a) == current($b)) {
   echo "error 2";
} else {
   echo "TRUE";
}