Class for handling number conversions
This class can only handle numbers without precision
category | Zend |
---|---|
package | Zend_Measure |
subpackage | Zend_Measure_Number |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
inherited_from | \Zend_Measure_Abstract |
__construct(integer $value, string $type, string|\Zend_Locale $locale = null
)
inherited_from | \Zend_Measure_Abstract::__construct() |
---|
integer
Value
string
(Optional) A Zend_Measure_Number Type
string
\Zend_Locale
(Optional) A Zend_Locale
\Zend_Measure_Exception |
When language is unknown |
---|---|
\Zend_Measure_Exception |
When type is unknown |
__construct(mixed $value, integer $type= null
, \Zend_Locale $locale= null
)
mixed
Value as string, integer, real or float
integer
OPTIONAL a measure type f.e. Zend_Measure_Length::METER
\Zend_Locale
OPTIONAL a Zend_Locale Type
\Zend_Measure_Exception |
---|
__toString() : string
string
add(\Zend_Measure_Abstract $object) : \Zend_Measure_Abstract
\Zend_Measure_Abstract
object of same unit type
\Zend_Measure_Abstract
compare(\Zend_Measure_Abstract $object) : boolean
\Zend_Measure_Abstract
object of same unit type
boolean
convertTo(string $type, integer $round= 0
, string|\Zend_Locale $locale= null
) : string
inherited_from | \Zend_Measure_Abstract::convertTo() |
---|
string
Type to convert to
integer
(Optional) Precision to add, will always be 0
string
convertTo(string $type, integer $round= 2
, string|\Zend_Locale $locale= null
) : string
string
Constant Type
integer
(Optional) Rounds the value to a given precision
string
\Zend_Locale
(Optional) Locale to set for the number
string
equals(\Zend_Measure_Abstract $object) : boolean
\Zend_Measure_Abstract
object to compare
boolean
getConversionList() : array
array
getLocale() : string
string
getType() : \type
\type
getValue(integer $round= -1
, string|\Zend_Locale $locale= null
) : integer | string
integer
(Optional) Rounds the value to an given precision, Default is -1 which returns without rounding
string
\Zend_Locale
(Optional) Locale for number representation
integer
string
setLocale(string|\Zend_Locale $locale= null
, boolean $check= false
) : \Zend_Measure_Abstract
string
\Zend_Locale
(Optional) New locale to set
boolean
False, check but don't set; True, set the new locale
\Zend_Measure_Abstract
setType(string $type) : void
inherited_from | \Zend_Measure_Abstract::setType() |
---|
string
New type to set
\Zend_Measure_Exception |
When a unknown type is given |
---|
setType(string $type) : \Zend_Measure_Abstract
string
New type to set
\Zend_Measure_Exception |
---|
\Zend_Measure_Abstract
setValue(integer $value, string $type= null
, string|\Zend_Locale $locale= null
)
inherited_from | \Zend_Measure_Abstract::setValue() |
---|
integer
Value
string
(Optional) A Zend_Measure_Number Type
string
\Zend_Locale
(Optional) A Zend_Locale Type
\Zend_Measure_Exception |
---|
setValue(integer|string $value, string $type= null
, string|\Zend_Locale $locale= null
) : \Zend_Measure_Abstract
integer
string
Value as string, integer, real or float
string
OPTIONAL A measure type f.e. Zend_Measure_Length::METER
string
\Zend_Locale
OPTIONAL Locale for parsing numbers
\Zend_Measure_Exception |
---|
\Zend_Measure_Abstract
sub(\Zend_Measure_Abstract $object) : \Zend_Measure_Abstract
\Zend_Measure_Abstract
object of same unit type
\Zend_Measure_Abstract
toString(integer $round= -1
, string|\Zend_Locale $locale= null
) : string
integer
(Optional) Runds the value to an given exception
string
\Zend_Locale
(Optional) Locale to set for the number
string
_fromDecimal(integer $value, string $type) : string
integer
Input string
string
Type to convert to
\Zend_Measure_Exception |
When more than 200 digits are calculated |
---|
string
_toDecimal(integer $input, string $type) : string
integer
Input string
string
Type from which to convert to decimal
string
$_locale : string
null
$_type : string
$_units : array
array('BINARY' => array(2, '⑵'), 'TERNARY' => array(3, '⑶'), 'QUATERNARY' => array(4, '⑷'), 'QUINARY' => array(5, '⑸'), 'SENARY' => array(6, '⑹'), 'SEPTENARY' => array(7, '⑺'), 'OCTAL' => array(8, '⑻'), 'NONARY' => array(9, '⑼'), 'DECIMAL' => array(10, '⑽'), 'DUODECIMAL' => array(12, '⑿'), 'HEXADECIMAL' => array(16, '⒃'), 'ROMAN' => array(99, ''), 'STANDARD' => 'DECIMAL')
inherited_from | \Zend_Measure_Abstract::_units |
---|
$_units
array()
$_value : string
$_roman : array
array('I' => 1, 'A' => 4, 'V' => 5, 'B' => 9, 'X' => 10, 'E' => 40, 'L' => 50, 'F' => 90, 'C' => 100, 'G' => 400, 'D' => 500, 'H' => 900, 'M' => 1000, 'J' => 4000, 'P' => 5000, 'K' => 9000, 'Q' => 10000, 'N' => 40000, 'R' => 50000, 'W' => 90000, 'S' => 100000, 'Y' => 400000, 'T' => 500000, 'Z' => 900000, 'U' => 1000000)
$_romanconvert : array
array('/_V/' => '/P/', '/_X/' => '/Q/', '/_L/' => '/R/', '/_C/' => '/S/', '/_D/' => '/T/', '/_M/' => '/U/', '/IV/' => '/A/', '/IX/' => '/B/', '/XL/' => '/E/', '/XC/' => '/F/', '/CD/' => '/G/', '/CM/' => '/H/', '/M_V/' => '/J/', '/MQ/' => '/K/', '/QR/' => '/N/', '/QS/' => '/W/', '/ST/' => '/Y/', '/SU/' => '/Z/')
BINARY = 'BINARY'
DECIMAL = 'DECIMAL'
DUODECIMAL = 'DUODECIMAL'
HEXADECIMAL = 'HEXADECIMAL'
NONARY = 'NONARY'
OCTAL = 'OCTAL'
QUATERNARY = 'QUATERNARY'
QUINARY = 'QUINARY'
ROMAN = 'ROMAN'
SENARY = 'SENARY'
SEPTENARY = 'SEPTENARY'
STANDARD = 'DECIMAL'
TERNARY = 'TERNARY'