Array
(
[oldAttributes] => Array
(
[id] => 1
[city_id] => 5
[status] => 0
[name] => test1
)
[newAttributes] => Array
(
[id] => 1
[city_id] => 8
[status] => 0
[name] => test2
)
)
<table style="width: 100%;" border="1">
<thead>
<tr>
<td>Attribute</td>
<td>Value</td>
</tr>
</thead>
<tbody>
<?php if (!empty($params)) foreach ($params as $param => $val): ?>
<?php foreach ($val as $k => $v): ?>
<tr>
<td><?= $k ?></td>
<td><?= $v ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
<tbody>
:<?php
foreach ($params['oldAttributes'] as $oldName => $oldValue) {
$newValue = $params['newAttributes'][$oldName];
printf( "<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$oldName,
$oldValue,
$newValue === $oldValue ? '' : $newValue
);
}
?>
<?php foreach ($oldAttributes as $k => $v): ?>
<tr>
<td><?= $k ?></td>
<td><?= $v ?></td>
<td><?= $newAttributes[$k] ?></td>
</tr>
<?php endforeach; ?>
<?php if (!empty($params)) foreach ($params["newAttributes"] as $param => $val): ?>
<tr>
<td><?= $k ?></td>
<td><?= $v ?></td>
<td><?= $params["oldAttributes"][$k] ?></td>
</tr>
<?php endforeach; ?>