I have two arrays:$row$rowTwoThe only difference between these two arrays are the first two keys have slightly different names due problems out of my control.I'm wondering if there is a cleaner way to do it. Or would it be simply easier to find a way to rename the arrays to match?        $needUpdate = false;        if (strcasecmp( $row['Trelease'] , $rowTwo['release'] ) != 0) {            $needUpdate = true;        }  else if (strcasecmp( $row['dateTime'] , $rowTwo['date'] ) != 0) {            $needUpdate = true;        } else if (strcasecmp( $row['defectID'] , $rowTwo['defectID'] ) != 0) {            $needUpdate = true;        } else if (strcasecmp( $row['type'] , $rowTwo['type'] ) != 0) {            $needUpdate = true;        } else if (strcasecmp( $row['severity'] , $rowTwo['severity'] ) != 0) {            $needUpdate = true;        } else if (strcasecmp( $row['summary'] , $rowTwo['summary'] ) != 0) {            $needUpdate = true;        }  else if (strcasecmp( $row['status'] , $rowTwo['status'] ) != 0) {            $needUpdate = true;        }  else if (strcasecmp( $row['link'] , $rowTwo['link'] ) != 0) {            $needUpdate = true;        }
Comparing two almost exact arrays
php;array
http://php.net/array_diffCompares array1 against one or more other arrays and returns the values in array1 that are not present in any of the other arrays. // Set the keys matching to the $rowTwo array$row['release'] = $row['Trelease'];$row['date'] = $row['dateTime'];// Unset the original values as we no longer need theseunset($row['Trelease'], $row['dateTime']);// Compare them:$difference = array_diff($row, $rowTwo);$needUpdate = count($difference)!==0;