Skip to content

Instantly share code, notes, and snippets.

@toshimaru
Created June 10, 2012 05:50
Show Gist options
  • Save toshimaru/2904021 to your computer and use it in GitHub Desktop.
Save toshimaru/2904021 to your computer and use it in GitHub Desktop.
output this week days.
<?php
$sunt = mktime(0, 0, 0, date("m"), date("d")-date("w"), date("Y")); // 今週の日曜日0時の時刻
for ($i = 0; $i < 7; $i++) {
$t = $sunt + $i * 60 * 60 * 24; //ワンステップで一日
$day = date("j", $t);
if ($day == date("j")) { //今日の場合
$day = "<b>{$day}</b>";
}
echo " <td>{$day}</td>\n";
}
/*
output:
27 28 29 30 1 2 3
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment