PHPackages                             portavice/permutation - 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. portavice/permutation

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

portavice/permutation
=====================

Generating permutations of arrays normal and recursive

1.2.2(2y ago)02.0k↓30%1MITPHPPHP ^8.0CI passing

Since Mar 26Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/portavice/Permutation)[ Packagist](https://packagist.org/packages/portavice/permutation)[ Docs](https://portavice.de)[ RSS](/packages/portavice-permutation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (5)Used By (0)

Permutation
===========

[](#permutation)

[![MIT Licensed](https://camo.githubusercontent.com/1a2e0606685ce00663bf829868f794fd3fc9c86f8d80cae324734129e0723a58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![PHP from Packagist](https://camo.githubusercontent.com/6d374c2fb799664469916d5227e4ba6a06a581075daa0c949dcd98c672cdb0a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f706f727461766963652f7065726d75746174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/portavice/permutation)[![Tests](https://github.com/portavice/Permutation/actions/workflows/tests.yml/badge.svg)](https://github.com/portavice/bladestrap/actions/workflows/tests.yml)[![Code style check](https://github.com/portavice/Permutation/actions/workflows/code-style.yml/badge.svg)](https://github.com/portavice/bladestrap/actions/workflows/code-style.yml)[![Latest Version](https://camo.githubusercontent.com/e31a425140831e1a330d864f6e8739144af46f163b908a810d102802a92e82fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f727461766963652f7065726d75746174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/portavice/permutation)[![Total Downloads](https://camo.githubusercontent.com/b702df40d4f27e33767ee90e0509d6996c8254a331482dc9184dee8a24aa3301/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706f727461766963652f7065726d75746174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/portavice/permutation)

This is a simple permutation library for PHP.

It can be used to generate all possible permutations of a given array.

It can also be used to generate all possible permutations of a given array recursively.

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

[](#installation)

To install this package with [Composer](https://getcomposer.org/):

To install it, just add the following to your `composer.json` file:

```
composer require portavice/permutation
```

Methods
-------

[](#methods)

MethodStaticRecursive`permutate()`NoNo`getPermutations(array $input, bool $withSort = false)`YesNo`getPermutationsWithCallback(array $input, callable $callback, bool $unsetAfterCall = false, mixed ...$args)`YesNo`permutateRecursive()`NoYes`getPermutationsRecursive(array $input, bool $withSort = false)`YesYes`getPermutationsRecursiveWithCallback(array $input, callable $callback, bool $unsetAfterCall = false, mixed ...$args)`YesYes`getResult(bool $sorted = false)`No`setOffset(int $offset)`No`setLimit(int $limit)`No`setCallback(callable $callback, bool $unsetAfterCall = false, mixed ...$args)`NoUsage
-----

[](#usage)

```
