xpaw / compare-arrays
Diffing multi dimensional arrays the easy way
2.0.0
2019-10-26 17:25 UTC
Requires
- php: >=7.2
Requires (Dev)
- phpunit/phpunit: ^8.3
This package is auto-updated.
Last update: 2024-10-25 11:21:40 UTC
README
Compares two arrays and produces a new array of changes between these two arrays.
New array will be same level deep as the input arrays, and the deepest value will be ComparedValue
,
which is an object describing the difference (added, removed, modified).
Optionally, use CompareArrays::Flatten()
function to turn diff array
into a one dimensional array which will flatten keys into a single path.
Usage:
$Differences = CompareArrays::Diff( $OldArray, $NewArray ); print_r( $Differences ); $Flattened = CompareArrays::Flatten( $Differences ); print_r( $Flattened );