$pageon = "11111111111111111111"; echo number_format($pageon);
im sure its something with my server, unless there is an override but my numbers are coming out like this 11,111,111,111,111,110,656
any help is appricated
11111111111111111111 is too large to fit into an integer, so it's converted to a double. And it's too precise to be stored in a double without rounding off.
so how do i fix this?
Make the number smaller, haha! Kidding aside, might want to try this:
echo strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev($pageon)));
that works, but what doesnt make sense, is the same coding worked fine until we moved servers
can u explain it?
It may be that the previous server supported 64-bit integers, while the current one does not?
4,294,967,296 (232) < 11,111,111,111,111,111,111 < 18,446,744,073,709,551,616 (264)
strrev(chunk_split(strrev($long_string_of_digits), 3, ','));
i still havent found if the numbers are screwed up when subtracting them from numbers in mysql
so ill pass this on with the other admin, but was really hoping for a way not to change every place we use big numbers, some setting, some overwrite
thanks all ill keep ya posted and if you got anything else feel free