I need to cast a tweet id, which is a long, to a string. For instance, I have:
$id = 39685855740174336;
But var_dump($id) prints float(3.9685855740174E+16).
I tried to get the string value using strval():
var_dump(strval($id));
but I get string(19) "3.9685855740174E+16".
What I expect is:
string(17) "39685855740174336".
Any solutions?
This works for me (see the list of string format specifiers):
Basically you treat it as a float, which in PHP it is, but ask
sprintf()not to include any decimal places.