PHPackages                             rogervila/array-diff-multidimensional - 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. rogervila/array-diff-multidimensional

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

rogervila/array-diff-multidimensional
=====================================

Compare the difference between two multidimensional arrays

2.2.0(8mo ago)1144.9M↓32.2%165MITPHPCI passing

Since Feb 20Pushed 2w ago4 watchersCompare

[ Source](https://github.com/rogervila/array-diff-multidimensional)[ Packagist](https://packagist.org/packages/rogervila/array-diff-multidimensional)[ RSS](/packages/rogervila-array-diff-multidimensional/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (6)Dependencies (1)Versions (11)Used By (5)

Array Diff Multidimensional
===========================

[](#array-diff-multidimensional)

[![Build Status](https://github.com/rogervila/array-diff-multidimensional/workflows/build/badge.svg)](https://github.com/rogervila/array-diff-multidimensional/actions)[![StyleCI](https://camo.githubusercontent.com/4886c5075b77bd55dfb02daf33d0e028f4700d8f9a92a9609dac8a3ea767de8e/68747470733a2f2f7374796c6563692e696f2f7265706f732f38323538393637362f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/82589676)[![Total Downloads](https://camo.githubusercontent.com/c0f2930c6ac8ed55f3dbf9a53ec382a0a78664bd6dfbd99f69f9d36cb834191b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f67657276696c612f61727261792d646966662d6d756c746964696d656e73696f6e616c)](https://packagist.org/packages/rogervila/array-diff-multidimensional)[![Latest Stable Version](https://camo.githubusercontent.com/9f8db62509a1aadc485e33971b28c6110f013adb9ff9d01ea189e85601eab267/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f67657276696c612f61727261792d646966662d6d756c746964696d656e73696f6e616c)](https://packagist.org/packages/rogervila/array-diff-multidimensional)[![License](https://camo.githubusercontent.com/a0791e2dd1fa0860bb58751b54afdabe2eb2602219ba45b7a468cb7217adaae0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f726f67657276696c612f61727261792d646966662d6d756c746964696d656e73696f6e616c)](https://packagist.org/packages/rogervila/array-diff-multidimensional)

Works like the [PHP array\_diff()](http://php.net/manual/es/function.array-diff.php) function, but with multidimensional arrays.

Install
-------

[](#install)

Via [composer](http://getcomposer.org):

```
composer require rogervila/array-diff-multidimensional
```

Usage
-----

[](#usage)

```
use Rogervila\ArrayDiffMultidimensional;

$new = [
	'a' => 'b',
	'c' => [
		'd' => 'e',
		'f' => 'Hello',
	],
];

$old = [
	'a' => 'b',
	'c' => [
		'd' => 'e',
		'f' => 'Goodbye',
	],
];

// Compare the arrays by calling the 'compare' class method
$result = ArrayDiffMultidimensional::compare($new, $old)

// Or by calling the global helper function
$result = array_diff_multidimensional($new, $old)

var_dump($result);
```

The result of comparing `$new` with `$old` will return a new array with the changes:

```
[
	'c' => [
		'f' => 'Hello'
 	],
]
```

Strict vs. Loose comparisons
----------------------------

[](#strict-vs-loose-comparisons)

**Comparisons are strict by default**, but you can specify that you want to make a loose comparison passing a boolean as the third parameter for `compare` method or calling the `looseComparison`

```
// Passing 'false' as a third parameter will deactivate the strict comparison mode
ArrayDiffMultidimensional::compare($new, $old, false);

array_diff_multidimensional($new, $old, false);

// This method call is equivalent
ArrayDiffMultidimensional::looseComparison($new, $old);
```

Also, a `strictComparison` method is available for more clarity

```
// Comparisons are strict by default
ArrayDiffMultidimensional::compare($new, $old);

array_diff_multidimensional($new, $old);

// This method call is equivalent
ArrayDiffMultidimensional::strictComparison($new, $old);
```

License
-------

[](#license)

Array Diff Multidimensional is an open-sourced package licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance80

Actively maintained with recent releases

Popularity59

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~632 days

Recently: every ~444 days

Total

6

Last Release

259d ago

Major Versions

1.0.0 → 2.0.0-rc.12020-12-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/351443b7d23e94fcf31b250db90f0b9578cc9fd8e0cefbed9666467e3e9cb571?d=identicon)[rogervila](/maintainers/rogervila)

---

Top Contributors

[![rogervila](https://avatars.githubusercontent.com/u/6053012?v=4)](https://github.com/rogervila "rogervila (34 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (30 commits)")[![aburakovskiy](https://avatars.githubusercontent.com/u/1153385?v=4)](https://github.com/aburakovskiy "aburakovskiy (1 commits)")[![bueltge](https://avatars.githubusercontent.com/u/133425?v=4)](https://github.com/bueltge "bueltge (1 commits)")[![ioanszabo](https://avatars.githubusercontent.com/u/4104187?v=4)](https://github.com/ioanszabo "ioanszabo (1 commits)")[![williamdes](https://avatars.githubusercontent.com/u/7784660?v=4)](https://github.com/williamdes "williamdes (1 commits)")

---

Tags

arraycomparediffmultidimensionalphp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rogervila-array-diff-multidimensional/health.svg)

```
[![Health](https://phpackages.com/badges/rogervila-array-diff-multidimensional/health.svg)](https://phpackages.com/packages/rogervila-array-diff-multidimensional)
```

###  Alternatives

[respect/stringifier

Converts any value to a string

2624.3M9](/packages/respect-stringifier)

PHPackages © 2026

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