I am currently working on a site where i need to convert amounts with letters behind it, example:
100M = 100.000.000
I have created a way to do this the other way, from:
100.000.000 = 100M
Here is my current function:
function Convert($Input){
if($Input<=1000){
$AmountCode = "GP";
$Amount = $Input;
}
else if($Input>=1000000){
$AmountCode = "M";
$Amount = floatval($Input / 1000000);
}
else if($Input>=1000){
$AmountCode = "K";
$Amount = $Input / 1000;
}
$Array = array(
'Amount' => $Amount,
'Code' => $AmountCode
);
$Result = json_encode($Array);
return json_decode($Result);
}
Now i need something that can filter out this:
100GP = 100
100K = 100.000
100M = 100.000.000
Ive been looking around for some things and ive tried with explode();
and other functions but it doesnt work like i want it to..
Is there anyone who can help me out ?