Skip to content

Instantly share code, notes, and snippets.

@tamura
Created May 13, 2015 07:30
Show Gist options
  • Save tamura/8a5058625b606b57f8fb to your computer and use it in GitHub Desktop.
Save tamura/8a5058625b606b57f8fb to your computer and use it in GitHub Desktop.
キーマージ
echo '<table class="table table-condensed table-bordered">';
$confkeys=array();
foreach ($config as $key => $row) {
# code...
$confkeys=array_merge($confkeys,array_keys($row));
}
$confkeys=array_unique($confkeys);
echo "<tr>";
foreach ($confkeys as $confk) {
# code...
printf('<th>%s</th>',$confk);
}
echo "</tr>";
foreach ($config as $key => $row) {
echo "<tr>";
foreach ($confkeys as $confk) {
# code...
printf('<td>%s</td>',mb_substr($row[$confk], 0, 12,"UTF8"));
}
echo "</tr>";
}
echo '</table>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment