No, PHP doesn't have what you want, but you could easily write your own functions (it's actually pretty easy). All you have to do is some basic math. Every next measurement unit is the previous measurement unit * 1024.
Does it measure the size in bytes??? The size of WHAT? Depends what your function is going to be used for - it could be pixels, it could be inches, it could be light years, it could be moles - it's your function, you decide.
When I do any php function that gets a size of something, does it measure the size in bytes? bits?
Functions like filesize return the size in bytes. The return values of all PHP functions are available in the PHP manual (there's always a section called "Return Values" with an explanation).
Originally Posted by Aaron
Does PHP have a built in function to convert these values, or do I have to write all that stuff?
It is very simple mathematics, essentially. There are hundreds of available functions available throughout the 'net which will take a byte value and convert it into any format that you want... but as a learning process I would recommend writing your own to do exactly what you want. All that are really needed are / (divide), (int) (type casting/juggling) or intval() (convert number to integer) -- or if you're feeling confident you could use shifting bitwise operators ;)
Also, on the topic of 1000 bytes versus 1024 bytes, two different systems are available for use. Using SI prefix, 1,000,000 bytes equals 1 megabyte (MB); using Binary prefix, 1,048,576 (1024 * 1024) bytes equals 1 mebibyte (MiB). Often, notably, the SI prefixes are used for both instances with the precise meaning being determined by the context in which the value is used! More information on this ambiguity can be found on Wikipedia.