曜日を表示する

<?php
function svgstart(){
header('Content-type: image/svg+xml');
print <<<EOD1
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="layer1"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"
 x="0px" y="0px"
 viewBox="0 0 841.9 595.3"
 style="enable-background:new 0 0 841.9 595.3;"
 xml:space="preserve">
<style type="text/css">
       .mfont{font-size:18pt;}
       .wfont{font-size:8pt;text-anchor:middle;}
       .dfont{font-size:11pt;text-anchor:middle;fill:white;}
       .dfont2{font-size:8pt;text-anchor:middle;fill:white;}
	   .c01{fill:#F8C17C;}
	   .c02{fill:#F29A5A;}
	   .c03{fill:#ED7235;}
</style>
EOD1;
}
function svgend() {
       print "</svg>\n";
}
function svgmonth($nen,$month,$bx=40,$by=40) {
       $weeks=array("SUN","MON","TUE","WED","THU","FRI","SAT");
       print "<g transform=\"translate({$bx},{$by})\">"; // 月の始まり
       for($i=0;$i<7;$i++) {
               $x = 25*$i+12;
               $w = $weeks[$i];
               print "<text class=\"wfont\" x=\"{$x}\" y=\"25\">{$w}</text>";
       }



       print "</g>\n"; // 月の終わり
}
// Main Program
svgstart();
svgmonth(2017,12);
svgend();