- var_dump: documentation ( source)
- array_filter: documentation ( source)
<?php
$original = ['test' => 'test', 'test2'=>'another test', 'test3' => 'third test'];
$address = ['test' => 'test', 'test2'=>'another test', 'test3' => 'third test diff', 'test4' => 'ignore me bro'];
$changes = array_filter($original, function ($key, $data) use ($address) {
return $data === $address->getData($key);
}, ARRAY_FILTER_USE_BOTH);
var_dump($changes);