I want to compare application / software version numbers, which sometimes can have two decimal points, such as:
1.0
1.1
1.0.01
1.0.1
2.0
2.5
3.0
etc .. etc ..
What would be the correct way to compare these numbers?
I tried this, but I get an error:
Parse error: syntax error, unexpected T_DNUMBER at / home / videocoo / public _html / dev / vc-admin / test_cmp.php on line 2
$a = 1.2.11;
$b = 1.2.0;
if($a > $b){
print"<br />a is greater";
} else {
print"<br />b is greater";
}
Is it wrong to make numbers in a string, wrapping them in double quotes? It seems that he gave the correct comparison every time I tested different numbers. Thank!
source
share