You can use the numberFormatter class for both making and stripping the formatting around values quite nicely:
You can format easily with format()
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
$data = numfmt_format($fmt, 1234567.891234567890000);
if(intl_is_failure(numfmt_format($fmt))) {
report_error("Formatter error");
}
?>
Output
1.234.567,891
Then, the parse() function will let you remove whatever formatting you applied to get back to your original format.
<?php
$fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL );
$num = "1.234.567,891";
echo numfmt_parse($fmt, $num)."\n";
echo numfmt_parse($fmt, $num, NumberFormatter::TYPE_INT32)."\n";
?>
Output:
1234567.891
Note: Keep in mind that if you are passing these things in forms and back and forth, you will potentially lose decimal places or the like if you format them down.