Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. function arrRecursiveDiff( $arr1, $arr2 ) {
  4. $aReturn = array();
  5.  
  6. foreach ( $arr1 as $mKey => $mValue ) {
  7. if ( array_key_exists( $mKey, $arr2 ) ) {
  8. if ( is_array( $mValue ) ) {
  9. $aRecursiveDiff = arrRecursiveDiff( $mValue, $arr2[$mKey] );
  10. if ( count( $aRecursiveDiff ) ) {
  11. $aReturn[$mKey] = $aRecursiveDiff;
  12. }
  13. } else {
  14. if ( $mValue != $arr2[$mKey] ) {
  15. $aReturn[$mKey] = $mValue;
  16. }
  17. }
  18. } else {
  19. $aReturn[$mKey] = $mValue;
  20. }
  21. }
  22. return $aReturn;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement