I have a database with a column containing a variety of numbers written in \"shorthand\", for example:
5k for 5,000
86.6k for 86,600
4.1m for 4,100,000
1
If this is your data format, and is consistent. you can write your own function. create a map of suffix to multiplier.. "k" => 1000, "m" => 100000
and multiply the integer value with multiplier value. Here is a sscanf based solution : http://codepad.org/FjwBbx1D
1000,"m" => 1000000,"b" => 1000000000);
$money = "86.6k";
list($value,$suffix) = sscanf($money, "%f%s");
$final = $value*$map[$suffix];
var_dump($final);
?>
And here is a simple one liner: