Skip to content
Compare the difference between two multidimensional arrays
PHP
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Apply fixes from StyleCI Feb 20, 2017
tests remove semicolons Feb 20, 2017
.codeclimate.yml
.gitignore initial commit Feb 20, 2017
.styleci.yml initial commit Feb 20, 2017
.travis.yml
README.md Add use Apr 13, 2018
appveyor.yml Update appveyor.yml Apr 13, 2018
composer.json multiple phpunit versions Feb 20, 2017
phpunit.xml initial commit Feb 20, 2017

README.md

Array Diff Multidimensional

Build Status Build status Code Climate StyleCI SensioLabsInsight

Works like the PHP array_diff() function, but with multidimensional arrays.

Install

Via composer:

composer require rogervila/array-diff-multidimensional

Usage

use Rogervila\ArrayDiffMultidimensional;

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

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

var_dump(ArrayDiffMultidimensional::compare($new,$old));

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

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

License

Array Diff Multidimensional is an open-sourced package licensed under the MIT license.

You can’t perform that action at this time.