I solved it myself. I'll post the solution if anyone needs it. Note the preg_replace, not ereg_replace.

$pattern = '/[^0-9,.]/';
$price_out = preg_replace($pattern, '', $price_out);
if...