charliekassel / array-diff
Find the difference between two array's
Installs: 124 954
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: >=7.0.0
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is not auto-updated.
Last update: 2024-11-10 05:45:57 UTC
README
Compute the changes between two arrays.
Work in progress.
Given two arrays:
$old = [ 'a' => 1, 'b' => 2, 'c' => 3 ]; $new = [ 'b' => 2, 'c' => 5 ]
We should expect an output of:
$differ = new \Differ\ArrayDiff(); $difference = $differ->diff($old, $new); var_dump($difference); array(3) { 'added' => array(0) { } 'removed' => array(1) { 'a' => int(1) } 'changed' => array(1) { 'c' => array(2) { 'old' => int(3) 'new' => int(5) } } }