Transform amounts to only use dot as decimal separator as 1234.56

This is how you can transform amounts into using only dot as separator for decimals, from amounts like 1 234,56 and 1.234,56 and 1 234,56, and remove any kind of thousand delimiter.

<?php
/**
 * Transform values to amount: 1234.50
 * From:
 * 1,234.00
 * 1.234,00
 * 1 234,00
 *
 * @param unknown_type $str
 * @return unknown
 */
function feeder_amount_transform_filter($str){
   
   
$dot = stripos($str, ".");
   
$com = stripos($str, ",");
   

    if (
$dot > 0 AND $com > 0) {
        if (
$dot > $com) {
           
//1,234.00
           
$str = str_replace(",", "", $str);
        }else{
           
//1.234,00
           
$str = str_replace(".", "", $str);
           
$str = str_replace(",", ".", $str);
        }
    }elseif(
$com > 0){
       
//1 234,00
       
$str = str_replace(",", ".", $str);
    }
   
   
$result = preg_replace("/[^0-9\.]/","", $str);
   
    return
feeder_numeric_validation_filter($result);
   
}
?>