Свежайшие Пирожки от CakePHP по-русски

Полнейшее руководство CakePHP 1.2 на русском языке, горячие новости и полезные статьи

toReadableSize

toReadableSize(string $data_size)

This method formats data sizes in human readable forms. It provides a shortcut way to convert bytes to KB, MB, GB, and TB. The size is displayed with a two-digit precision level, according to the size of data supplied (i.e. higher sizes are expressed in larger terms):

Простой текст
  1. echo $number->toReadableSize(0); // 0 Bytes
  2. echo $number->toReadableSize(1024); // 1 KB
  3. echo $number->toReadableSize(1321205.76); // 1.26 MB
  4. echo $number->toReadableSize(5368709120); // 5.00 GB