Reputation: 4746
I have numbers like these...
1.235,45
100,00
5,5678
25.321,10
But I need those numbers in the following format:
1235.45
100
5.5678
25321.1
Upvotes: 1
Views: 3062
Reputation: 96258
function cnv($str) {
$str = str_replace(".", "", $str);
$str = str_replace(",", ".", $str);
return (float) $str;
}
Upvotes: 0
Reputation: 5799
$number = str_replace('.', '', $number);
$number = str_replace(',', '.', $number);
$number = (float)$number;
Should do the trick.
Upvotes: 3