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
Something like:
switch (strtolower(substr($input, -1))) { case 'k': $input*=1000; break; // similarly for m, M, b, B. }
Assuming your data is well-formatted. If not more check would be needed like:
if (!preg_match('/^\d+(?:\.\d+)?[mbk]$/i',$input)) { // $input is not a valid format. }