aburakovskiy / array-diff-multidimensional

Compare the difference between two multidimensional arrays

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

$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.

About

Compare the difference between two multidimensional arrays


Languages

Language:PHP 100.0%