Welcome Guest, Not a member yet? Register   Sign In
Form validation with Greater Than won't work with international currencies (comma separated decimal numbers)
#8

[eluser]Aken[/eluser]
You'll want to sanitize the numbers further, because given your example, a number with thousands would then contain more than one decimal point, providing incorrect results when comparing. For example:

Code:
$num1 = '102,33';
$num2 = '1.044,98';

$num1 = str_replace(',', '.', $num1); // 102.33
$num2 = str_replace(',', '.', $num2); // 1.044.98

var_dump($num1 > $num2); // bool(true)


Messages In This Thread
Form validation with Greater Than won't work with international currencies (comma separated decimal numbers) - by El Forum - 04-26-2012, 09:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB