Skip to content

Instantly share code, notes, and snippets.

@johnroyer
Created July 31, 2014 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save johnroyer/c744e20685f939595698 to your computer and use it in GitHub Desktop.
Save johnroyer/c744e20685f939595698 to your computer and use it in GitHub Desktop.
Array Compare Recursively
/**
* Compare if two array are totally the same
*
* @return bool
*/
function isArraySameRecursively($o, $c){
if(count(array_diff_assoc($o, $c)) > 0){
return false;
}
foreach($o as $key => $elem){
if(is_array($elem)){
if(isArraySameRecursively($o[$key], $c[$key]) == false){
return false;
}
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment