PHPackages                             dashifen/modcount - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dashifen/modcount

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dashifen/modcount
=================

an object that produces a series of numbers over and over again

1.0.3(6y ago)06MITPHPPHP &gt;=7.3

Since Apr 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/dashifen/modcount)[ Packagist](https://packagist.org/packages/dashifen/modcount)[ RSS](/packages/dashifen-modcount/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (4)Used By (0)

Dashifen/Modcount
=================

[](#dashifenmodcount)

Sometimes it's handy to have a way to produce a sequence of numbers that repeats from zero to some number N. Primarily, this is useful for accessing an array over and over again if you have the need to do so.

Usage
-----

[](#usage)

```
$modcount = new Modcount(3);
echo $modcount->count();        // produces 0
echo $modcount->count();        // produces 1
echo $modcount->count();        // produces 2
echo $modcount->count();        // produces 0
echo $modcount->count();        // produces 1

```

You can also do all of that like this if you prefer:

```
$modcount = new Modcount(3);
echo $modcount();
echo $modcount();
echo $modcount();

```

So, why would I use this?
-------------------------

[](#so-why-would-i-use-this)

It's entirely possible that no one other than Dash ever will. That's okay, he loves it. His primary need for it is the repetitious printing of HTML table cell `headers` attribute values in a loop:

```
$users = $database->getUsers();
$cols  = ["id", "name", "email", "phone"];
$modcount = new Modcount(sizeof($cols));

foreach($users as $user) {
    echo '';

    foreach($user as $datum) {
         echo sprintf('%s',
            $cols[$modcount()],
            $datum);
    }

    echo '';
}

```

This is a poor example because using the loop index of that inner `foreach` loop would do the same thing, but more complicated situations can arise making this object handy.

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~477 days

Total

3

Last Release

2397d ago

PHP version history (3 changes)1.0.0PHP ^7.1

1.0.1PHP 7.3.\*

1.0.3PHP &gt;=7.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8269?v=4)[David Dashifen Kees](/maintainers/dashifen)[@dashifen](https://github.com/dashifen)

---

Top Contributors

[![dashifen](https://avatars.githubusercontent.com/u/8269?v=4)](https://github.com/dashifen "dashifen (4 commits)")

### Embed Badge

![Health badge](/badges/dashifen-modcount/health.svg)

```
[![Health](https://phpackages.com/badges/dashifen-modcount/health.svg)](https://phpackages.com/packages/dashifen-modcount)
```

###  Alternatives

[silverstripe/blog

A fresh take on blogging in Silverstripe set out to tackle the issue of a cluttered Site Tree.

102753.0k32](/packages/silverstripe-blog)[sulu/sylius-producer-plugin

Producer for synchronization products with sulu.

1044.3k](/packages/sulu-sylius-producer-plugin)

PHPackages © 2026

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