divinedesigns1 Posted August 5, 2012 Share Posted August 5, 2012 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 More sharing options...
boen_robot Posted August 5, 2012 Share Posted August 5, 2012 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 More sharing options...
divinedesigns1 Posted August 5, 2012 Author Share Posted August 5, 2012 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 More sharing options...
birbal Posted August 5, 2012 Share Posted August 5, 2012 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 More sharing options...
divinedesigns1 Posted August 5, 2012 Author Share Posted August 5, 2012 thanks Link to comment Share on other sites More sharing options...
dsonesuk Posted August 5, 2012 Share Posted August 5, 2012 actually 1byte=8bits1kilobyte=1024 bytes1megabyte=1024kilobytes1gigabyte=1024 megabytes Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 5, 2012 Author Share Posted August 5, 2012 actually 1byte=8bits1kilobyte=1024 bytes1megabyte=1024kilobytes1gigabyte=1024 megabytesso its 2*1024*1024*8 thanks once again Link to comment Share on other sites More sharing options...
justsomeguy Posted August 6, 2012 Share Posted August 6, 2012 Another way: 1KB = 2101MB = 2201GB = 230 etc... just add 10 to the exponent to go to terabytes, exabytes, yottabytes, etc. So 2MB would be 2 * 220 Link to comment Share on other sites More sharing options...
divinedesigns1 Posted August 6, 2012 Author Share Posted August 6, 2012 thanks jsg Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now