Works like the PHP array_diff() function, but with multidimensional arrays.
Via composer:
composer require rogervila/array-diff-multidimensional
$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'
],
]
Array Diff Multidimensional is an open-sourced package licensed under the MIT license.