PHPackages                             cse/helpers-math-converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. cse/helpers-math-converter

ActiveLibrary[Framework](/categories/framework)

cse/helpers-math-converter
==========================

A mathematics helpers, providing functionality for numbers converter.

1.0.1(7y ago)67121MITPHPPHP &gt;=7.1

Since Mar 10Pushed 7y ago3 watchersCompare

[ Source](https://github.com/cs-eliseev/helpers-math-converter)[ Packagist](https://packagist.org/packages/cse/helpers-math-converter)[ Docs](https://github.com/cs-eliseev/helpers-math-converter)[ RSS](/packages/cse-helpers-math-converter/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (3)Used By (1)

English | [Русский](https://github.com/cs-eliseev/helpers-math-converter/blob/master/README.ru_RU.md)

MATH CONVERTER CSE HELPERS
==========================

[](#math-converter-cse-helpers)

[![Travis (.org)](https://camo.githubusercontent.com/1a3d8aa789fd83bf393e61e5fef6ad8c7df78b9a3b6f853bd64e3f1bd1d2c17c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f63732d656c69736565762f68656c706572732d6d6174682d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/cs-eliseev/helpers-math-converter)[![Codecov](https://camo.githubusercontent.com/8c761f664ca6d10326bf5c912a62dbe835240ff45fc26f4466729faaab1c046b/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f63732d656c69736565762f68656c706572732d6d6174682d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/cs-eliseev/helpers-math-converter)[![Scrutinizer code quality](https://camo.githubusercontent.com/9102608997c9c95bc93df0f31712965c10045fedcab6b6c7cb506ab59c42af11/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f63732d656c69736565762f68656c706572732d6d6174682d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/cs-eliseev/helpers-math-converter/?branch=master)

[![Packagist](https://camo.githubusercontent.com/94b334b93c1c2d6ed6603413e593dcbea6133bfc233671de5abe65960d5f7914/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6373652f68656c706572732d6d6174682d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cse/helpers-math-converter)[![Minimum PHP Version](https://camo.githubusercontent.com/dcd4b4aec2c1709157fa6a2c050f709d75cde9552a79cfff0b70a97fad7281ae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cse/helpers-math-converter)[![Packagist](https://camo.githubusercontent.com/b3761fcc635a148c9886e93124d63d5870fd29facd64c48fe23db27b083b1895/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6373652f68656c706572732d6d6174682d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/cs-eliseev/helpers-math-converter/blob/master/LICENSE.md)[![GitHub repo size](https://camo.githubusercontent.com/f3ab9e098154e8bbf7e3b099802860d0b36772fc63155f15540cfcca6bcde840/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f63732d656c69736565762f68656c706572732d6d6174682d636f6e7665727465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/cs-eliseev/helpers-math-converter/archive/master.zip)

A mathematics helpers, providing functionality for numbers converter.

Project repository:

**DEMO**

```
$mb = MathConverter::toMb('300K');
$sub = bcsub(
    MathConverter::roundDecimal($mb, 4),    // 0.293
    MathConverter::cutDecimal($mb, 4),      // 0.2929
    4
);
// 0.0001
MathConverter::binToHex($sub);
// 302e30303031
```

---

Introduction
------------

[](#introduction)

[CSE HELPERS](https://github.com/cs-eliseev/helpers/blob/master/README.md) is a collection of several libraries with simple functions written in PHP for people.

Despite using PHP as the main programming language for the Internet, its functions are not enough. MATH CONVERTER CSE HELPERS providing functionality for numbers converter.

[CSE HELPERS](https://github.com/cs-eliseev/helpers/blob/master/README.md) was created for the rapid development of web applications.

**CSE Helpers project:**

- [Array CSE helpers](https://github.com/cs-eliseev/helpers-arrays)
- [Cookie CSE helpers](https://github.com/cs-eliseev/helpers-cookie)
- [Date CSE helpers](https://github.com/cs-eliseev/helpers-date)
- [Email CSE helpers](https://github.com/cs-eliseev/helpers-email)
- [IP CSE helpers](https://github.com/cs-eliseev/helpers-ip)
- [Json CSE helpers](https://github.com/cs-eliseev/helpers-json)
- [Math Converter CSE helpers](https://github.com/cs-eliseev/helpers-math-converter)
- [Phone CSE helpers](https://github.com/cs-eliseev/helpers-phone)
- [Request CSE helpers](https://github.com/cs-eliseev/helpers-request)
- [Session CSE helpers](https://github.com/cs-eliseev/helpers-session)
- [Word CSE helpers](https://github.com/cs-eliseev/helpers-word)

Below you will find some information on how to init library and perform common commands.

Install
-------

[](#install)

You can find the most recent version of this project [here](https://github.com/cs-eliseev/helpers-math-converter).

### Composer

[](#composer)

Execute the following command to get the latest version of the package:

```
composer require cse/helpers-math-converter
```

Or file composer.json should include the following contents:

```
{
    "require": {
        "cse/helpers-math-converter": "*"
    }
}
```

### Git

[](#git)

Clone this repository locally:

```
git clone https://github.com/cs-eliseev/helpers-math-converter.git
```

### Download

[](#download)

[Download the latest release here](https://github.com/cs-eliseev/helpers-math-converter/archive/master.zip).

Usage
-----

[](#usage)

The class consists of static methods that are conveniently used in any project. See example [examples-math-converter.php](https://github.com/cs-eliseev/helpers-math-converter/blob/master/examples/examples-math-converter.php).

**Convert HEX TO BINARY**

Example:

```
MathConverter::hexToBin('48454c4c4f');
// HELLO
```

**Convert BINARY TO HEX**

Example:

```
MathConverter::binToHex('HELLO');
// 48454c4c4f
```

**Convert MEGABYTES TO BYTES**

Example:

```
MathConverter::mbToBytes(1);
// 1048576
```

**Convert BYTES TO MEGABYTES**

Example:

```
MathConverter::bytesToMb(1048576);
// 1
```

Change decimal:

```
MathConverter::bytesToMb(1000000, 4);
// 0.9537
```

**Convert GIGABYTES TO BYTES**

Example:

```
MathConverter::gbToBytes(1);
// 1073741824
```

**Convert BYTES TO GIGABYTES**

Example:

```
MathConverter::bytesToGb(1073741824);
// 1
```

Change decimal:

```
MathConverter::bytesToGb(1000000000, 4);
// 0.9313
```

**Convert GIGABYTES TO MEGABYTES**

Example:

```
MathConverter::gbToMb(1);
// 1024
```

**Convert MEGABYTES TO GIGABYTES**

Example:

```
MathConverter::mbToGb(1024);
// 1
```

Change decimal:

```
MathConverter::mbToGb(1000, 4);
// 0.9766
```

**Convert TO MEGABYTES**

Example:

```
MathConverter::toMb('1M');
// 1
```

Petabyte to megabyte:

```
MathConverter::toMb('0.001P');
// 1073741.824
```

Terabyte to megabyte:

```
MathConverter::toMb('0.1T');
// 104857.6.824
```

Gigabyte to megabyte:

```
MathConverter::toMb('1G');
// 1024
```

Kilobyte to megabyte:

```
MathConverter::toMb('1000K');
// 0.9765625
```

Byte to megabyte:

```
MathConverter::toMb('1000000B');
// 0.95367431640625
```

**CUT DECIMAL**

Example:

```
MathConverter::cutDecimal(11.726);
// 11.72
```

Change decimal:

```
MathConverter::cutDecimal('-67.099', 1);
// -67
```

**ROUND DECIMAL**

Example:

```
MathConverter::roundDecimal(11.726);
// 11.73
```

Change decimal:

```
MathConverter::roundDecimal('-67.099', 0);
// -67
```

Testing &amp; Code Coverage
---------------------------

[](#testing--code-coverage)

PHPUnit is used for unit testing. Unit tests ensure that class and methods does exactly what it is meant to do.

General PHPUnit documentation can be found at .

To run the PHPUnit unit tests, execute:

```
phpunit PATH/TO/PROJECT/tests/
```

If you want code coverage reports, use the following:

```
phpunit --coverage-html ./report PATH/TO/PROJECT/tests/
```

Used PHPUnit default config:

```
phpunit --configuration PATH/TO/PROJECT/phpunit.xml
```

Donating
--------

[](#donating)

You can support this project [here](https://www.paypal.me/cseliseev/10usd). You can also help out by contributing to the project, or reporting bugs. Even voicing your suggestions for features is great. Anything to help is much appreciated.

License
-------

[](#license)

The MATH CONVERTER CSE HELPERS is open-source PHP library licensed under the MIT license. Please see [License File](https://github.com/cs-eliseev/helpers-math-converter/blob/master/LICENSE.md) for more information.

---

> GitHub [@cs-eliseev](https://github.com/cs-eliseev)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~48 days

Total

2

Last Release

2572d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d3b9e49d0ce3fd71c8eb31b7c14e48373dbb415a9d16950ce52d23bf89b2ae26?d=identicon)[ak\_eliseev](/maintainers/ak_eliseev)

---

Top Contributors

[![cs-eliseev](https://avatars.githubusercontent.com/u/24221291?v=4)](https://github.com/cs-eliseev "cs-eliseev (72 commits)")

---

Tags

convertercseframeworkhelperhelperslibrarymathmathsphptooltoolsutilitiesutilityutilsframeworkhelperutilityhelperslibrarytoolconvertermathcollectioncollectionstoolsutilsutilitiescsemaths

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cse-helpers-math-converter/health.svg)

```
[![Health](https://phpackages.com/badges/cse-helpers-math-converter/health.svg)](https://phpackages.com/packages/cse-helpers-math-converter)
```

###  Alternatives

[cse/helpers-session

The helpers allows you to easily manage session data. START, SET, GET DELETE, HAS method session - all this is available in this library.

102.6k3](/packages/cse-helpers-session)[jbzoo/utils

Collection of PHP functions, mini classes and snippets for everyday developer's routine life.

8321.5M36](/packages/jbzoo-utils)[dragon-code/support

Support package is a collection of helpers and tools for any project.

238.7M101](/packages/dragon-code-support)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
