2017 © Pedro PelĂĄez
 

project number

Converter and wrapping object for a number (float or integer) value

image

granam/number

Converter and wrapping object for a number (float or integer) value

  • Tuesday, July 10, 2018
  • by jaroslavtyc
  • Repository
  • 1 Watchers
  • 1 Stars
  • 7,963 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 5 % Grown

The README.md

Converter and object wrapper for a number (float or integer) value

Build Status, (*1)

<?php
use Granam\Number\NumberObject;
use \Granam\Number\Tools\Exceptions\WrongParameterType;

$stringFloatToNumber = new NumberObject('123.456');
var_dump($stringFloatToNumber->getValue()); // double(123.456)
var_dump((string)$stringFloatToNumber); // string(7) "123.456"

$stringIntToNumber = new NumberObject('123');
var_dump($stringIntToNumber->getValue()); // int(123)
var_dump((string)$stringIntToNumber); // string(7) "123"

$nullToNumber = new NumberObject(null);
var_dump($nullToNumber->getValue()); // int(0)
var_dump((string)$nullToNumber); // string(1) "0"

$tooLongDecimalToNumber = new NumberObject($withTooLongDecimal = '123456.999999999999999999999999999999999999');
var_dump($tooLongDecimalToNumber->getValue());// int(123457); because of intval(floatval($value))

try {
  new NumberObject('123.999999999999999999999999999999', true /* paranoid to rounding */);
} catch (WrongParameterType $floatNumberException) {
  // Something get wrong: Some value has been lost on cast. Given string-number '123456.999999999999999999999999999999999999' results into float 123457
  die('Something get wrong: ' . $floatNumberException->getMessage());
}

The Versions

10/07 2018

4.0.x-dev

4.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

10/07 2018

4.0.0

4.0.0.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

10/07 2018

dev-master

9999999-dev https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

10/07 2018

3.0.x-dev

3.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

19/02 2017

3.0.1

3.0.1.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

18/02 2017

3.0.0

3.0.0.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

15/02 2017

2.0.x-dev

2.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

15/02 2017

2.0.2

2.0.2.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

15/02 2017

2.0.1

2.0.1.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

15/02 2017

2.0.0

2.0.0.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

10/09 2015

1.1.x-dev

1.1.9999999.9999999-dev https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

10/09 2015

1.1.2

1.1.2.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

09/09 2015

1.1.1

1.1.1.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

02/09 2015

1.1.0

1.1.0.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

17/08 2015

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

17/08 2015

1.0.1

1.0.1.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer

17/08 2015

1.0.0

1.0.0.0 https://github.com/jaroslavtyc/granam-number

Converter and wrapping object for a number (float or integer) value

  Sources   Download

MIT

The Requires

 

The Development Requires

php number float integer