In PHP, the number is converted into a percentile, which is a kilobytes...

Source: Internet
Author: User
In today's project, we need to display the number of clicks in the article on the page, which is tens of thousands of requests. Although it is not difficult, it has been a programmer for so long, it is no longer a simple implementation, and it is efficient and fast. Although the built-in function number_format () in PHP can achieve sub-bits, what I want is a ten-thousandth bit.

In today's project, we need to display the number of clicks in the article on the page, which is tens of thousands of requests. Although it is not difficult, it has been a programmer for so long, it is no longer a simple implementation, and it is efficient and fast. Although the built-in function number_format () in PHP can achieve sub-bits, what I want is a ten-thousandth bit.

In today's project, we need to display the number of clicks in the article on the page, which is tens of thousands of requests. Although it is not difficult, it has been a programmer for so long, it is no longer a simple implementation that needs to be considered, and it is efficient and fast,

Although the built-in function number_format () in PHP can implement Sub-bits, what I want is ten-thousandths,

After searching, you can use the following method:

$ Num = 86231; # convert a number into a ten-minute echo $ num> 10000? Sprintf ("%. 1f", $ num/10000): $ num;

Similarly, with this method, you can modify it to implement percentile, kilobytes, and thousandths... Data requirements.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.