How to determine change between two arrays

Recently, I was building a historical data tracker, which would track any changes in settings across a large application. All of the settings would be pulled from their MySQL tables and stored in a PHP array. Storing those settings (just short of 25,000 of them) would have been unfeasible on the MySQL database. At the time, we didn’t have a Mongo instance running either.

So I serialized each array and stored it as its own record. Every minute, a cron would kick off the script, which would pull the latest record, deserialize it, and check each value recursively to determine if the value changed. If the value did change, then it would store the new array as a new record. It would then kick off an email saying a setting was changed.

The interesting bit is how the arrays were checked against each other, recursively: