<?php
$rowblock = -2;
$rows = array();
foreach ($profile as $i => $user) {
if ($i%4 == 0) {
$rows[] = '<tr>';
$rows[] = '<tr>';
$rowblock += 2;
}
$rows[$rowblock] .= "<td><img src='/profile/user/{$user['pro_img']}'>";
$rows[$rowblock+1] .= "<td><p>{$user['pro_fam']} {$user['pro_im']} {$user['pro_otch']}<p>{$user['dol_name']}";
}
for ($i = $i%4; $i < 3; $i++) {
$rows[$rowblock] .= "<td>";
$rows[$rowblock+1] .= "<td>";
}
echo "<table>",implode('', $rows),"</table>";
?>