Fluent BCMath

A fluent interface for the PHP BCMath extension

Write more readable code, while maintaining the performance of the BCMath extension

use Illegal\FluentBCMath\BCNumber;
$num = new BCNumber('1.23', 2);

$num
	->add(2)->sub(2)->mul(2)
	->div(2)->mod(3)->pow(2)->sqrt();

Introduction

Getting started

Welcome to the documentation for the Fluent BCMath PHP Package


What is PHP BCMath?

BCMath, short for Binary Calculator Mathematics, is a PHP extension designed to handle arbitrary-precision arithmetic operations with high accuracy. It is particularly useful for working with large integers or decimals that exceed the limits of PHP's built-in data types.

What is Fluent BCMath

The Fluent BCMath package provides an intuitive, fluent interface for the PHP BCMath extension, enabling you to write more readable and maintainable code without sacrificing the performance benefits of the underlying extension. With Fluent BCMath, you can effortlessly perform complex mathematical calculations while ensuring precision and reliability in your PHP applications.

use Illegal\FluentBCMath\BCNumber;
$num = new BCNumber('2', 2);

$num
	->add(2)->sub(2)->mul(2); // 4

Interested in learning more?

Install the package and explore the usage and reference sections for additional information

Fluent BCMath is a project by illegal studio