This function is compatible for numbers with dots or commas as decimals
function floatvalue($val){
$val = str_replace(",",".",$val);
$val = preg_replace('/\.(?=.*\.)/', '', $val);
return floatval($val);
}
This works for all kind of inputs (American or european style)
echo floatvalue('1.325.125,54'); // The output is 1325125.54
echo floatvalue('1,325,125.54'); // The output is 1325125.54
echo floatvalue('59,95'); // The output is 59.95
echo floatvalue('12.000,30'); // The output is 12000.30
echo floatvalue('12,000.30'); // The output is 12000.30