<?php
for ($i=0; $i<10; $i++) {
}
$rowspan = 1;
// $post = mysql_fetch_assoc($posts);
while ($post):
// $pre = mysql_fetch_assoc($posts);
if (isset($pre) && $pre['a'] == $post['a']) { $post['rowspan'] = 0;
$rowspan++;
} else {
$post['rowspan'] = $rowspan;
$rowspan = 1;
}
$postArray[] = $post;
$post = $pre;
endwhile;
?>
<table>
<thead>
<tr>
<th>名前</th>
<th>内容</th>
</tr>
</thead>
<tbody>
<tr>
<?php if ($post['rowspan'] !== 0){ ?>
<?php if ($post['rowspan'] === 1){ ?>
<td>
<?php } else { ?>
<td rowspan="<?php echo $post['rowspan']; ?>">
<?php } ?>
<?php echo $post['a']; ?></td>
<?php } ?>
<td><?php echo $post['b']; ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
PD9waHAKJHRlc3RkYXRhID0gYXJyYXkoKTsKZm9yICgkaT0wOyAkaTwxMDsgJGkrKykgewogICAgJHRlc3RkYXRhW10gPSBhcnJheSgnYScgPT4gaW50dmFsKCRpLzMpLCAnYicgPT4gJGkpOwp9CgokcG9zdEFycmF5ID0gYXJyYXkoKTsKJHJvd3NwYW4gPSAxOwovLyAkcG9zdCA9IG15c3FsX2ZldGNoX2Fzc29jKCRwb3N0cyk7CiRwb3N0ID0gYXJyYXlfcG9wKCR0ZXN0ZGF0YSk7CndoaWxlICgkcG9zdCk6Ci8vICAkcHJlID0gbXlzcWxfZmV0Y2hfYXNzb2MoJHBvc3RzKTsKICAgICRwcmUgPSBhcnJheV9wb3AoJHRlc3RkYXRhKTsKICAgIGlmIChpc3NldCgkcHJlKSAmJiAkcHJlWydhJ10gPT0gJHBvc3RbJ2EnXSkgewogICAgICAgICRwb3N0Wydyb3dzcGFuJ10gPSAwOwogICAgICAgICRyb3dzcGFuKys7CiAgICB9IGVsc2UgewogICAgICAgICRwb3N0Wydyb3dzcGFuJ10gPSAkcm93c3BhbjsKICAgICAgICAkcm93c3BhbiA9IDE7CiAgICB9CiAgICAkcG9zdEFycmF5W10gPS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