Created
January 25, 2010 16:09
-
-
Save ollym/285967 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns a list containing items in need of deleteing, and item's in need of adding. | |
* | |
* list($adding, $deleting) = arr::diff($source, $current); | |
* | |
* @param array The new array. | |
* @param array The existing array. | |
* @returns array | |
*/ | |
public static function diff(array $source, array $current) | |
{ | |
// Uses a two way array_diff algorithm to calculate the differences | |
return array( | |
array_diff($source, $current), | |
array_diff($current, $source) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment