CodeIgniter User Guide Version 1.6.3


Number Helper

The Number Helper file contains functions that help you work with numeric data.

Loading this Helper

This helper is loaded using the following code:

$this->load->helper('number');

The following functions are available:

byte_format()

Formats a numbers as bytes, based on size, and adds the appropriate suffix. Examples:

echo byte_format(456); // Returns 456.0 Bytes
echo byte_format(4567); // Returns 4.5 KB
echo byte_format(45678); // Returns 44.8 KB
echo byte_format(456789); // Returns 447.8 KB
echo byte_format(3456789); // Returns 3.3 MB
echo byte_format(12345678912345); // Returns 1.8 GB
echo byte_format(123456789123456789); // Returns 11,228.3 TB