https://github.com/krissss/bcmath
PHP bcmath quick write.
https://github.com/krissss/bcmath
bcmath php-bcmath php-math
Last synced: 7 months ago
JSON representation
PHP bcmath quick write.
- Host: GitHub
- URL: https://github.com/krissss/bcmath
- Owner: krissss
- Created: 2018-08-14T10:23:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-27T09:39:03.000Z (11 months ago)
- Last Synced: 2025-06-27T20:08:21.460Z (8 months ago)
- Topics: bcmath, php-bcmath, php-math
- Language: PHP
- Size: 46.9 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kriss BCMath
PHP bcmath quick write.
# Install
```
composer require kriss/bcmath -vvv
```
## Usage
```php
2])->add(1.2)->mul(2)->sub(1.5)->getResult();
echo $result; // 3.9
$result = BC::create(['scale' => 2])->add(1.2, 1.3, 1.5, 1.8);
echo $result; // 5.8
$result = BCParser::create(['scale' => 4])->parse('5*3+3.5-1.8/7');
echo $result; // 18.2429
$result = BCSummary::create(['scale' => 4])->average(18, ['A' => 1, 'B' => 2, 'C' => 3]);
echo $result; // ['A' => 3, 'B' => 6, 'C' => 9]
$result = BCSummary::create(['scale' => 2])->upgrade(18, 36, 100) . '%';
echo $result; // 100%
```
more example see `tests/phpunit`