summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/helpers/number_helper.rst
diff options
context:
space:
mode:
authorJoël Cox <joel@joelcox.nl>2011-10-09 18:45:09 +0200
committerJoël Cox <joel@joelcox.nl>2011-10-09 18:45:09 +0200
commit8ffcb2c8c7ef3da54d7e46c29d502533e413c820 (patch)
tree1f94e2e81b4d20f2df827b8a84eeda27032161a1 /user_guide_src/source/helpers/number_helper.rst
parentf4fb1db458fab52d0493ead52c9ea7e01206eaa7 (diff)
parent6858c0753a7221796d6a5a1d7fea93cc2f9feb2e (diff)
Merged develop branch in tutorial.
Diffstat (limited to 'user_guide_src/source/helpers/number_helper.rst')
-rw-r--r--user_guide_src/source/helpers/number_helper.rst45
1 files changed, 45 insertions, 0 deletions
diff --git a/user_guide_src/source/helpers/number_helper.rst b/user_guide_src/source/helpers/number_helper.rst
new file mode 100644
index 000000000..28bc2f200
--- /dev/null
+++ b/user_guide_src/source/helpers/number_helper.rst
@@ -0,0 +1,45 @@
+#############
+Number Helper
+#############
+
+The Number Helper file contains functions that help you work with
+numeric data.
+
+.. contents:: Page Contents
+
+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 Bytes
+ echo byte_format(4567); // Returns 4.5 KB
+ echo byte_format(45678); // Returns 44.6 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
+
+An optional second parameter allows you to set the precision of the
+result.
+
+::
+
+ echo byte_format(45678, 2); // Returns 44.61 KB
+
+.. note:: The text generated by this function is found in the following
+ language file: language//number_lang.php