tags:

views:

212

answers:

3

Hi, how can I convert kilobytes to bytes in php? Let's say I get the value 22.2 kb and I want to return this in bytes.

Thanks, Max

+6  A: 

This sounds like homework, but 1Kb = 1024 bytes, so you should be able to determine the equation.

James Black
+3  A: 

multiply by 1024

corymathews
Teach a man to fish...
LiraNuna
"Multiply by 1000", you mean.
endolith
A kilobyte in decimal format is 1000, but for nearly all software purposes you need the binary format which is 1024. Reference: http://en.wikipedia.org/wiki/Kilobyte
Eddie
+1  A: 

If you're ever confused for comparable values, you can always google "1 megabyte in kilobytes" and it will return the comparative value.

Citizen
http://www.wolframalpha.com/input/?i=1+MB+in+kBhttp://www.wolframalpha.com/input/?i=1+MiB+in+KiB
endolith