Image

Imagebrentmj wrote in Imagephp

Comparing Data

I have two arrays. one is data from a database, one is data from a form. If the data in the two arrays are the same, meaning no changes were made to the form, then I want to know so that a database update is not needed. If the data are different, then I want to not only update the database, but mark the time and date of the new update.

Here's what I've come up with:
$difference=array_diff($formdata, $dbdata);
$num_diff=count($difference);
if ($num_diff!=0){ update Database & set new date_updated }

Might there be a more elegant way to do this?