I am playing with Twitter API. Some numbers (like Twitter ID) is really large such as 199693823725682700.
I’ve got this number as string format, and now I need to change it to just normal readable number, not like 1000xE09, because I need to substract -1 from that string-casted number. Then, I also need to send the number as string.
In sum, in PHP, how can I change the string a number, e.g., “199693823725682700” to another string “199693823725682699” (original number -1)?
Thanks a lot!
If BCMath is not available (it would be the preferable option if it is available) this function will decrement an arbitrarily sized integer stored as a string. There is no handling for floats or interpolation of scientific notation, it will only work with a string of decimal digits with an optional sign.
See it working