Format File Size into Byte, KB, MB, GB and TB with PHP

We can calculate a file's size using PHP's build in filesize function. This function returns file size in byte(integer). This value is good enough to working with file but this value is quite heard for human eyes if this value is big to bigger. We can give a nice formatted look to this value by using some code very. Here is a simple example of function byte_convert that can convert file size into byte, kb, mb, gb and tb.