PHPackages                             michaelc/intdiv-compat - 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. michaelc/intdiv-compat

ActiveLibrary

michaelc/intdiv-compat
======================

A compatibility library for the simplified intdiv function in PHP 7: https://wiki.php.net/rfc/intdiv

1.0.1(10y ago)514.7k↓100%1MITPHPPHP &gt;=5.3.0

Since Oct 19Pushed 10y ago1 watchersCompare

[ Source](https://github.com/michaelcullum/intdiv_compat)[ Packagist](https://packagist.org/packages/michaelc/intdiv-compat)[ Docs](https://github.com/michaelcullum/intdiv_compat)[ RSS](/packages/michaelc-intdiv-compat/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (4)Used By (0)

intdiv\_compat
==============

[](#intdiv_compat)

[![Travis CI](https://camo.githubusercontent.com/12ccffd145863e7f0a94f4c8f3303259ed7767797ac37fe34edeabe926d74402/68747470733a2f2f6170692e7472617669732d63692e6f72672f6d69636861656c63756c6c756d2f696e746469765f636f6d7061742e737667)](https://camo.githubusercontent.com/12ccffd145863e7f0a94f4c8f3303259ed7767797ac37fe34edeabe926d74402/68747470733a2f2f6170692e7472617669732d63692e6f72672f6d69636861656c63756c6c756d2f696e746469765f636f6d7061742e737667)

This library/polyfill provides the intdiv function that was added in PHP 7 in PHP 5.3 and later.

For more information see the [RFC](https://wiki.php.net/rfc/intdiv).

Requirements
------------

[](#requirements)

Requires PHP 5.3.0 or later due to exceptions

Installation
------------

[](#installation)

Either `require` the `src/intdiv.php` file or install using [Composer](https://getcomposer.org/)

`composer require michaelc/intdiv-compat`

Usage
-----

[](#usage)

`int intdiv ( int $dividend , int $divisor )`

Returns the integer quotient of the division of dividend by divisor

If divisor is 0, a DivisionByZeroError exception is thrown. If the dividend is ~PHP\_INT\_MAX (PHP\_INT\_MIN was introduced in PHP 7) and the divisor is -1, then an ArithmeticError exception is thrown.

See  for more information

Please note, if you define \\Error in userland and it does not extend either \\Throwable (Built-in PHP 7) or \\Exception then an error will arise as the \\Error class will be attempted to be redeclared.

If \\Error exists and extends \\Throwable or \\Exception then we do not redeclare it. If \\Error does not exist or exists but does not extend \\Throwable or \\Exception, we declare it and extend \\Exception.

This library can be safely included on a system running PHP 7 and it will not affect core PHP 7 `intdiv()` usage.

Tests
-----

[](#tests)

To run tests:

```
  composer install
  vendor/bin/phpunit

```

###  Health Score

33

—

LowBetter than 76% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 55.6% 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 ~0 days

Total

2

Last Release

3808d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/51b8f5fa2478c474c026976512454ce9953323d2d07d0a5320b3a3bd3f4653d8?d=identicon)[michaelcullum](/maintainers/michaelcullum)

---

Top Contributors

[![michaelcullum](https://avatars.githubusercontent.com/u/211740?v=4)](https://github.com/michaelcullum "michaelcullum (30 commits)")[![AndrewCarterUK](https://avatars.githubusercontent.com/u/6486835?v=4)](https://github.com/AndrewCarterUK "AndrewCarterUK (24 commits)")

---

Tags

division

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/michaelc-intdiv-compat/health.svg)

```
[![Health](https://phpackages.com/badges/michaelc-intdiv-compat/health.svg)](https://phpackages.com/packages/michaelc-intdiv-compat)
```

###  Alternatives

[rinvex/universities

Rinvex Universities is a simple and lightweight package for retrieving university details with flexibility. A whole bunch of data including name, country, state, email, website, telephone, address, and much more attributes for the 17k+ known universities worldwide at your fingertips.

6616.0k](/packages/rinvex-universities)

PHPackages © 2026

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