PHP implements the original method of converting Byte to KB, MB, GB, and TB.
This example describes how to convert the number of bytes in PHP to KB, MB, GB, or TB. We will share this with you for your reference. The details are as follows:
The previous section describes how to convert the number of bytes in java to
Use the FileSize () function command to implement statistics for file size, requiring: 1, one output in GB, MB, KB, B, 2. The order of magnitude must be greater than 1 less than 1024 and retain two decimal places;
Commencement of construction:
Copy Code code as follows:
$len = FileSize ("1.RMVB");
$i = 4;
while ($i) {
if ($out = $len/pow (1024, $i) >1.0| | $i ==1) {
Switch ($i) {
C
We often hear about who drives the broadband is 4M or 10M or 20M and so on. So this is the same as what we call "how much MB/s" and "How many kb/s"?In fact, this is not a concept.Broadband operators in the broadband, such as 4M, is actually said 4M bit/s, that is, bits per second.And what we call the download speed is b/s, that is, bytes per second.Remember two relationships: 1b/s = 8 b/s;1 M =1024k.So 1M o
The fastest way to calculate the file size, output amp; apos; B amp; apos;, amp; apos; KB amp; apos ;, amp; apos; MB amp;
So far, it may be the fastest calculation method.Is it faster?
Date_default_timezone_set ('utc ');
Function format_bytes ($ size)
{
$ Arr = array ('B', 'KB', '
The smallest basic unit is byte should not have many people do not know, the following first in order to give all units
Byte, KB, MB, GB, TB, PB, EB, ZB, YB, DB, NB
I only know the top five, and most people know it, according to the rate of 1024 calculation
1tb=2 's 40-Time Square byte=1099511627776 Byte
1pb=2 's 50-time Square Byte=1125899906842624byte
1eb=2 60-Time Square byte= 1152921504606846976 Byte
1z
Recently solved a problem-reducing memory usage. However, this method can only be used in WINXP and Win2k, without displaying that the main form is always running.ProgramBest. In the past, the program used 11 MB of memory. I used the dynamic window creation method to reduce the size by less than 100 kb. After applying this method, the memory usage was only 496 kb
equals 8 bits (1byte=8bit). Eight-bit binary number minimum is 00000000, the maximum is 11111111; usually 1 bytes can be stored in an ASCII code, 2 bytes can hold a Chinese character GB code.3, the wordWhen a computer is processing data, the length of time it accesses, processes, and transmits is called word. A word is usually made up of one or more bytes (usually the integer bits of bytes). For example, the word 286 microcomputer consists of 2 bytes, its word length is 16;486 microcomputer's w
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.