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.2b for 1,200,000,000
I’d like to do some calculations with these numbers for a PHP frontend, but I need to convert them into valid integers in order to do so. How could I do this with PHP?
Something like:
Assuming your data is well-formatted. If not more check would be needed like: