Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function arrRecursiveDiff( $arr1, $arr2 ) {
- $aReturn = array();
- foreach ( $arr1 as $mKey => $mValue ) {
- if ( array_key_exists( $mKey, $arr2 ) ) {
- if ( is_array( $mValue ) ) {
- $aRecursiveDiff = arrRecursiveDiff( $mValue, $arr2[$mKey] );
- if ( count( $aRecursiveDiff ) ) {
- $aReturn[$mKey] = $aRecursiveDiff;
- }
- } else {
- if ( $mValue != $arr2[$mKey] ) {
- $aReturn[$mKey] = $mValue;
- }
- }
- } else {
- $aReturn[$mKey] = $mValue;
- }
- }
- return $aReturn;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement