Jump to content
xisto Community
Sign in to follow this  
beeseven

Outputting Large Numbers

Recommended Posts

Usually when you output a large number (>14 digits), it takes it and turns it into an exponential expression (eg: 1.6E+15). Is there a way to change it so that it doesn't turn it into that and just keeps outputting all the digits?

Share this post


Link to post
Share on other sites

The first two options that spring to mind would be assigning the value to a string variable type, or using the number_format() function (which returns the value as a string, and also groups the digits in blocks of three seperated by a comma, by default).

For example:

// If printed, would display '1.e+14'$number = 100000000000000;// If printed, would display the value as a string, exactly as you see it// (the quotes indicate a string value)$number = '100000000000000';// If printed, would display the number with digit grouping$number = number_format(1.e+14);

Hope that explains things for you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.