<?php
function floatvalue($value) {
return floatval(preg_replace('#^([-]*[0-9\.,\' ]+?)((\.|,){1}([0-9-]{1,2}))*$#e', "str_replace(array('.', ',', \"'\", ' '), '', '\\1') . '.\\4'", $value));
}
?>
It is much shorter and able to handle those one, too:
xx,-
xx,--
xx'xxx,xx
After using floatvalue() you can go forward with number_format() as usual.