| [ Index ] |
PHP Cross Reference of Akelos Framework |
[Source view] [Print]
(no description)
| Author: | Bermi Ferrer |
| Copyright: | Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org |
| License: | GNU Lesser General Public License |
| File Size: | 194 lines (8 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
NumberHelper:: (9 methods):
number_to_phone()
number_to_currency()
number_to_percentage()
number_with_delimiter()
number_to_human_size()
human_size()
human_size_to_bytes()
number_with_precision()
zeropad()
Class: NumberHelper - X-Ref
Provides methods for converting a number into a formatted string that currently represents| number_to_phone($number, $options = array() X-Ref |
| Formats a +number+ into a US phone number string. The +options+ can be a array used to customize the format of the output. The area code can be surrounded by parentheses by setting +area_code+ to true; default is false The delimiter can be set using +delimiter+; default is "-" Examples: $number_helper->number_to_phone(1235551234) => 123-555-1234 $number_helper->number_to_phone(1235551234, array('area_code' => true)) => (123) 555-1234 $number_helper->number_to_phone(1235551234, array('delimiter' => " ")) => 123 555 1234 $number_helper->number_to_phone(1235551234, array('area_code' => true, 'extension' => 555)) => (123) 555-1234 x 555 |
| number_to_currency($number, $options = array() X-Ref |
| Formats a +number+ into a currency string. The +options+ array can be used to customize the format of the output. The +number+ can contain a level of precision using the +precision+ key; default is 2 The currency type can be set using the +unit+ key; default is "$" The unit separator can be set using the +separator+ key; default is "." The delimiter can be set using the +delimiter+ key; default is "," Examples: $number_helper->number_to_currency(1234567890.50) => $1,234,567,890.50 $number_helper->number_to_currency(1234567890.506) => $1,234,567,890.51 $number_helper->number_to_currency(1234567890.50, array('unit' => "£", 'separator' => ",", 'delimiter' => "")) => £1234567890,50 $number_helper->number_to_currency(1234567890.50, array('unit' => " €", 'separator' => ",", 'delimiter' => ".", 'unit_position' => 'right')) => 1.234.567.890,50 € |
| number_to_percentage($number, $options = array() X-Ref |
| Formats a +number+ as into a percentage string. The +options+ array can be used to customize the format of the output. The +number+ can contain a level of precision using the +precision+ key; default is 2 The unit separator can be set using the +separator+ key; default is "." Examples: $number_helper->number_to_percentage(100) => 100.00% $number_helper->number_to_percentage(100, array('precision' => 0)) => 100% $number_helper->number_to_percentage(302.0576, array('precision' => 3)) => 302.058% |
| number_with_delimiter($number, $delimiter=',') X-Ref |
| Formats a +number+ with a +delimiter+. Example: $number_helper->number_with_delimiter(12345678) => 12,345,678 |
| number_to_human_size($size, $decimal = 1) X-Ref |
| No description |
| human_size($size) X-Ref |
| No description |
| human_size_to_bytes($size) X-Ref |
| No description |
| number_with_precision($number, $precision=3) X-Ref |
| Formats a +number+ with a level of +precision+. Example: $number_helper->number_with_precision(111.2345) => 111.235 |
| zeropad($number, $length) X-Ref |
| Add zeros to the begining of the string until it reaches desired length Example: $number_helper->zeropad(123, 6) => 000123 |
| Generated: Mon Oct 27 12:43:49 2008 | Cross-referenced by PHPXref 0.6 |