Forum Moderators: coopster

Message Too Old, No Replies

PHP Number (Integer & Float) problem

         

Mahabub

8:17 pm on Jun 8, 2010 (gmt 0)

10+ Year Member



One of my host php PHP Version IS 5.3.1

Showing this integer (128374350519540) number as like below
1.2837435051954E+14


Another host showing it correctly as like 128374350519540 .
and this host PHP version is: 5.2.13

how to solve this problem that integer value not show as exp. is there any php.ini issue.

Any help would be highly appreciated.

Thanks
Mahabub

Alcoholico

8:35 pm on Jun 8, 2010 (gmt 0)

10+ Year Member



For this sort of numbers you should use GMP functions, see [php.net...]

jatar_k

8:35 pm on Jun 8, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



could you describe "showing"?

what code are you using to print/echo/display?

Mahabub

3:28 am on Jun 9, 2010 (gmt 0)

10+ Year Member



Jatar_k,

I used var_dump cause that value was in a array basically it is a facebook application id and I got that ID by called FB specific API METHOD which return the ID, appication name and other info in a array. Then I just print the array.

$fb_app_id = $facebook->api---> ($args);
var_dump($fb_app_id);


Thanks
Mahabub

Mahabub

3:31 am on Jun 9, 2010 (gmt 0)

10+ Year Member



Alcoholico,

can you kindly tell me specific GMP function.


Thanks
Mahabub

Alcoholico

2:55 pm on Jun 9, 2010 (gmt 0)

10+ Year Member



That depends on what you want to do and how you are doing it as jatar_k has already asked you. For starters try gmp_strval() but certainly, for precision, you should use GMP functions all the way from the start.

Mahabub

9:41 pm on Jun 9, 2010 (gmt 0)

10+ Year Member



Alcoholico, Thanks for the information i will check it out and let you know.

Thanks
Mahabub

Mahabub

9:56 am on Jun 28, 2010 (gmt 0)

10+ Year Member



Okay, The problem is solved from php.ini by a slight larger value of precision.

Thanks
Mahabub

coopster

12:02 pm on Jul 9, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Precision is also operating system dependent so be advised!
Integers [php.net]