note 74690 deleted from control-structures.foreach by tularis
| From: | tularis@php.net | Date: | Mon, 23 Apr 2007 21:31:00 +0000 |
| Subject: | note 74690 deleted from control-structures.foreach by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125813@lists.php.net to get a copy of this message | ||
Note Submitter: jeff at trunkofjunk dot com
Reason: useless
----
#
# compare_arrays($array1,$array2)
# compare 2 similar arrays and return any different values - left overtakes the right -
#
function compare_arrays($array1,$array2) {
if ( is_array($array1) ) {
foreach ( $array1 as $key1 => $value1 ) {
if ( is_array($array2) ) {
foreach ( $array2 as $key2 => $value2 ) {
if ( $key1 == $key2 ) {
if ( is_array($value1) ) {
$this->compare_arrays($value1,$value2);
}
if ( isset($value1) && $value1 !==
$value2 ) {
$changed[$key1] = $value1;
}
}
}
}
}
}
return $changed;
} // end compare_arrays()