From a935c3f0b0c733641c0b3b6cc8c2f4b2e3df71f2 Mon Sep 17 00:00:00 2001
From: Derek Jones
Date: Thu, 19 Jun 2008 17:42:55 +0000
Subject: added a Number helper
---
system/helpers/number_helper.php | 68 ++++++++++++++++++++++++++++++++++++++++
user_guide/changelog.html | 1 +
2 files changed, 69 insertions(+)
create mode 100644 system/helpers/number_helper.php
diff --git a/system/helpers/number_helper.php b/system/helpers/number_helper.php
new file mode 100644
index 000000000..f158b1cdc
--- /dev/null
+++ b/system/helpers/number_helper.php
@@ -0,0 +1,68 @@
+= 1000000000)
+ {
+ $num = round($num/107374182)/10;
+ $unit = 'GB';
+ }
+ elseif ($num >= 1000000)
+ {
+ $num = round($num/104857)/10;
+ $unit = 'MB';
+ }
+ elseif ($num >= 1000)
+ {
+ $num = round($num/102)/10;
+ $unit = 'KB';
+ }
+ else
+ {
+ $unit = 'Bytes';
+ }
+
+ return number_format($num, 1).' '.$unit;
+ }
+}
+
+/* End of file number_helper.php */
+/* Location: ./system/helpers/number_helper.php */
\ No newline at end of file
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index ab006e78e..bf26a67ae 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -76,6 +76,7 @@ SVN Revision: not currently released
Helpers
+ - Added a Number helper.
- Form helper refactored to allow form_open() and form_fieldset() to accept arrays or strings as arguments.
--
cgit v1.2.3-24-g4f1b