blob: 28bc2f2009bfee244eaa240584b36b506eb78548 [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001#############
2Number Helper
3#############
4
5The Number Helper file contains functions that help you work with
6numeric data.
7
8.. contents:: Page Contents
9
10Loading this Helper
11===================
12
13This helper is loaded using the following code
14
15::
16
17 $this->load->helper('number');
18
19The following functions are available:
20
21byte_format()
22=============
23
24Formats a numbers as bytes, based on size, and adds the appropriate
25suffix. Examples
26
27::
28
29 echo byte_format(456); // Returns 456 Bytes
30 echo byte_format(4567); // Returns 4.5 KB
31 echo byte_format(45678); // Returns 44.6 KB
32 echo byte_format(456789); // Returns 447.8 KB
33 echo byte_format(3456789); // Returns 3.3 MB
34 echo byte_format(12345678912345); // Returns 1.8 GB
35 echo byte_format(123456789123456789); // Returns 11,228.3 TB
36
37An optional second parameter allows you to set the precision of the
38result.
39
40::
41
42 echo byte_format(45678, 2); // Returns 44.61 KB
43
44.. note:: The text generated by this function is found in the following
45 language file: language//number_lang.php