Jump to content

how to write mega bits


divinedesigns1

Recommended Posts

hello, can someone point me to a page that display how to write bits in php, im trying to write 2 mb but i think im writing it wrong. so i would like to make sure that im writing it correctly or can someone tell me how to write 2mb in php

Link to comment
Share on other sites

You mean write it as an integer or what?2 MiB (2 megabytes, as seen in OSes, erroneously with the "MB" suffix, where the base is 1024) can be expressed as "2 * 1024 * 1024".2 MB (2 megabytes, as seen on HDD offers, where the base is 1000) can be expressed as "2 * 1000 * 1000".2 Mbit (2 megabits, as seen on ISP offers, where the base is 1000, except that the measurement is in bits, not bytes) can be expressed as "(2 * 1000 * 1000) / 8" (the "/ 8" is used to convert the value from bits to bytes).

Link to comment
Share on other sites

You mean write it as an integer or what? 2 MiB (2 megabytes, as seen in OSes, erroneously with the "MB" suffix, where the base is 1024) can be expressed as "2 * 1024 * 1024". 2 MB (2 megabytes, as seen on HDD offers, where the base is 1000) can be expressed as "2 * 1000 * 1000". 2 Mbit (2 megabits, as seen on ISP offers, where the base is 1000, except that the measurement is in bits, not bytes) can be expressed as "(2 * 1000 * 1000) / 8" (the "/ 8" is used to convert the value from bits to bytes).
yes in integer, i wrote 2mb as 20,195,152 and wanted to know if thats correct or not
Link to comment
Share on other sites

1byte=8bits1kilobyte=1000 bytes1megabyte=1000kilobytes1gigabyte=1000 megabytes and it is now just simple math2megabyte=2*1000*1000*8 bits

Link to comment
Share on other sites

actually 1byte=8bits1kilobyte=1024 bytes1megabyte=1024kilobytes1gigabyte=1024 megabytes
so its 2*1024*1024*8 thanks once again
Link to comment
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
×
×
  • Create New...