PHPackages                             pronamic/wp-number - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. pronamic/wp-number

ActiveWordpress-plugin[Localization &amp; i18n](/categories/localization)

pronamic/wp-number
==================

WordPress Number library.

v1.4.1(1mo ago)493.4k↓43.5%14GPL-2.0-or-laterPHPPHP &gt;=7.4CI failing

Since Jul 2Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/pronamic/wp-number)[ Packagist](https://packagist.org/packages/pronamic/wp-number)[ RSS](/packages/pronamic-wp-number/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (30)Versions (13)Used By (14)

Pronamic WordPress Number
=========================

[](#pronamic-wordpress-number)

 WordPress Number library.

[![Latest Stable Version](https://camo.githubusercontent.com/fd3e3c1b7ac902069e9437e8d878d71baa0a001d928c4a857966d1d10a02ea84/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f77702d6e756d6265722f76)](https://packagist.org/packages/pronamic/wp-number)[![Total Downloads](https://camo.githubusercontent.com/7c447b0361abe84b18b295d0c48f588150e12e7030fa617ceba36bd7c92da918/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f77702d6e756d6265722f646f776e6c6f616473)](https://packagist.org/packages/pronamic/wp-number)[![Latest Unstable Version](https://camo.githubusercontent.com/2e5544592a23b915e9d3c833a3cb2206ff80278b1267328886b28e7bf73ca068/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f77702d6e756d6265722f762f756e737461626c65)](https://packagist.org/packages/pronamic/wp-number)[![License](https://camo.githubusercontent.com/ad582d9fcd55912f27fd7f52ad1dba42c2fd7741940d7e60dabf0fa15c02a550/687474703a2f2f706f7365722e707567782e6f72672f70726f6e616d69632f77702d6e756d6265722f6c6963656e7365)](https://packagist.org/packages/pronamic/wp-number)[![codecov](https://camo.githubusercontent.com/e047484ee98dc0b7c9b3ce82e04ac26e6ad4e79b6f29e6ea725d9410733d90cd/68747470733a2f2f636f6465636f762e696f2f67682f70726f6e616d69632f77702d6e756d6265722f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d4e423342314653314350)](https://codecov.io/gh/pronamic/wp-number)[![Coverage Status](https://camo.githubusercontent.com/ed4e57168e9093d8127cc6d06c235f839dc6983520cfce202fe2683169444c58/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f70726f6e616d69632f77702d6e756d6265722f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/pronamic/wp-number?branch=main)

Table of contents
-----------------

[](#table-of-contents)

- [Getting Started](#getting-started)
- [Usage](#usage)
- [Design Principles](#design-principles)

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

```
composer require pronamic/wp-number

```

Usage
-----

[](#usage)

```
$number = Number::from_float( 123.50 )->add( 0.45 );

echo \esc_html( $number->format_i18n( 2 ) );

```

Design Principles
-----------------

[](#design-principles)

### A number is a number

[](#a-number-is-a-number)

> In general, a number is a number, not a string, and this means that any programming language treats a number as a number. Thus, the number by itself doesn't imply any specific format (like using .000021 instead of 2.1e-5). This is nothing different to displaying a number with leading zeros (like 0.000021) or aligning lists of numbers. This is a general issue you'll find in any programming language: if you want a specific format you need to specify it, using the format functions of your programming language.
>
> Unless you specify the number as string and convert it to a real number when needed, of course. Some languages can do this implicitly.

### Number in exponential form / scientific notation

[](#number-in-exponential-form--scientific-notation)

> 2.1E-5 is the same number as 0.000021. That's how it prints numbers below 0.001. Use printf() if you want it in a particular format.
>
> **Edit** If you're not familiar with the `2.1E-5` syntax, you should know it is shorthand for 2.1×10-5. It is how most programming languages represent numbers in scientific notation.

### Leading zeros

[](#leading-zeros)

In  it is not allowed to use leading zeros:

> Leading zeros are not allowed

*Source:*

This probably has somehting to do with the following user note:

> Be careful with GMP - it considers leading zeros in a number string as meaning the number is in octal, whereas 'bc' doesn't:
>
> `gmp_strval("000100", 10) => 64`
>
> `bcmul("000100", "1") => 100`

*Source:*

```

```

*Source:*

> A leading zero in a numeric literal means "this is octal". But don't be confused: a leading zero in a string does not. Thus: `$x = 0123;          // 83``$y = "0123" + 0     // 123`

*Source:*

Links
-----

[](#links)

-

[![Pronamic - Work with us](https://github.com/pronamic/brand-resources/raw/main/banners/pronamic-work-with-us-leaderboard-728x90%404x.png)](https://www.pronamic.eu/contact/)

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance89

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82% 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 ~156 days

Recently: every ~169 days

Total

12

Last Release

57d ago

PHP version history (3 changes)1.0.0PHP &gt;=5.6.20

v1.2.0PHP &gt;=8.0

v1.2.1PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/869674?v=4)[Remco Tolsma](/maintainers/remcotolsma)[@remcotolsma](https://github.com/remcotolsma)

![](https://avatars.githubusercontent.com/u/10371164?v=4)[Reüel van der Steege](/maintainers/rvdsteege)[@rvdsteege](https://github.com/rvdsteege)

---

Top Contributors

[![remcotolsma](https://avatars.githubusercontent.com/u/869674?v=4)](https://github.com/remcotolsma "remcotolsma (114 commits)")[![rvdsteege](https://avatars.githubusercontent.com/u/10371164?v=4)](https://github.com/rvdsteege "rvdsteege (25 commits)")

---

Tags

calculatordecimalfloating-pointi18nlibrarynumberphpwordpresswordpressi18nDoublecalculatornumberfloatint

###  Code Quality

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pronamic-wp-number/health.svg)

```
[![Health](https://phpackages.com/badges/pronamic-wp-number/health.svg)](https://phpackages.com/packages/pronamic-wp-number)
```

###  Alternatives

[symfony/string

Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way

1.8k724.1M827](/packages/symfony-string)[symfony/intl

Provides access to the localization data of the ICU library

2.6k199.8M1.1k](/packages/symfony-intl)[jackocnr/intl-tel-input

A JavaScript plugin for entering and validating international telephone numbers

8.2k243.6k2](/packages/jackocnr-intl-tel-input)[gettext/gettext

PHP gettext manager

70130.2M102](/packages/gettext-gettext)[qtranslate/qtranslate-xt

qTranslate-XT (eXTended): Adds user-friendly multilingual content support, stored in single post.

59935.5k](/packages/qtranslate-qtranslate-xt)[gettext/languages

gettext languages with plural rules

7530.3M11](/packages/gettext-languages)

PHPackages © 2026

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