Hola, GonzaH:
Te agradezco que hayas logrado resolver "el misterio de las comillas insidiosas".
En cuanto al error en el código, yo detecté que me faltaba un "break" al final del primer bucle. Ya lo solucioné, y ahora funciona para octubre y también para noviembre (que era mi gran duda). Voy a pegar todos los códigos más abajo.
Espero que ya no me moleste más este calendario, porque lo que el texto llama "ampliación voluntaria del ejercicio", en mi caso ha sido una "ampliación masoquista del ejercicio".
¡Saludos!
CALENDARIO OCTUBRE 2015:
<h1>Calendario</h1>
<style>
table{
width:300px;
font-size:24px;
}
</style>
<?php
$mes = date("m",mktime(0,0,0,10,1,2015));
$año = date ("Y",mktime(0,0,0,10,1,2015));
$semana = array ("Mon","Tue", "Wed", "Thu","Fri","Sat","Sun");
echo "<table>";
echo "<thead>";
echo "<tr>";
echo "<th colspan='7'>",date("M, Y",mktime(0,0,0,10,1,2015)),"</th>";
echo "</tr>";
echo "<tr>";
echo "<th>Lu</th><th>Ma</th><th>Mi</th><th>Ju</th><th>Vi</th><th>Sa</th><th>Do</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
//// MARCO EL DÍA 1º DEL MES: ////////////////////
echo "<tr>";
for ($i=0;$i<=6;$i++){
if (date("D",mktime(0,0,0,10,1,2015))==$semana[$i]){
echo "<td>", date("d", mktime(0,0,0,10,1,2015)) ,"</td>";
if ( date("D",mktime(0,0,0,10,1,2015))=="Sun" ){
echo "</tr>","<tr>";
break;
}else{
break;
}
break;
}else{
echo "<td>", "</td>" ;
}
}
/////////marco los días subsiguientes////////////////////
for ($j=2;$j<=date("t",mktime(0,0,0,10,1,2015));$j++){
if ( date("D",mktime(0,0,0,10,$j,2015))=="Sun" ) {
echo "<td>", date("d", mktime(0,0,0,10,$j,2015)), "</td >", "</tr>", "<tr>";
}else{
echo "<td>", date("d", mktime(0,0,0,10,$j,2015)) , "</td>" ;
}
}
echo "</tr>";
echo "</tbody>";
echo "</table>";
?>
CALENDARIO NOVIEMBRE 2015:
<h1>Calendario</h1>
<style>
table{
width:300px;
font-size:24px;
}
</style>
<?php
$mes = date("m",mktime(0,0,0,11,1,2015));
$año = date ("Y",mktime(0,0,0,11,1,2015));
$semana = array ("Mon","Tue", "Wed", "Thu","Fri","Sat","Sun");
echo "<table>";
echo "<thead>";
echo "<tr>";
echo "<th colspan='7'>",date("M, Y",mktime(0,0,0,11,1,2015)),"</th>";
echo "</tr>";
echo "<tr>";
echo "<th>Lu</th><th>Ma</th><th>Mi</th><th>Ju</th><th>Vi</th><th>Sa</th><th>Do</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
//// MARCO EL DÍA 1º DEL MES: ////////////////////
echo "<tr>";
for ($i=0;$i<=6;$i++){
if (date("D",mktime(0,0,0,11,1,2015))==$semana[$i]){
echo "<td>", date("d", mktime(0,0,0,11,1,2015)) ,"</td>";
if ( date("D",mktime(0,0,0,11,1,2015))=="Sun" ){
echo "</tr>","<tr>";
break;
}else{
break;
}
break;
}else{
echo "<td>", "</td>" ;
}
}
/////////marco los días subsiguientes////////////////////
for ($j=2;$j<=date("t",mktime(0,0,0,11,1,2015));$j++){
if ( date("D",mktime(0,0,0,11,$j,2015))=="Sun" ) {
echo "<td>", date("d", mktime(0,0,0,11,$j,2015)), "</td >", "</tr>", "<tr>";
}else{
echo "<td>", date("d", mktime(0,0,0,11,$j,2015)) , "</td>" ;
}
}
echo "</tr>";
echo "</tbody>";
echo "</table>";
?>
CALENDARIO DEL MES EN CURSO:
<h1>Calendario</h1>
<style>
table{
width:300px;
font-size:24px;
}
</style>
<?php
$mes = date("m");
$año = date ("Y");
$semana = array ("Mon","Tue", "Wed", "Thu","Fri","Sat","Sun");
echo "<table>";
echo "<thead>";
echo "<tr>";
echo "<th colspan='7'>",date("M, Y"),"</th>";
echo "</tr>";
echo "<tr>";
echo "<th>Lu</th><th>Ma</th><th>Mi</th><th>Ju</th><th>Vi</th><th>Sa</th><th>Do</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
//// MARCO EL DÍA 1º DEL MES: ////////////////////
echo "<tr>";
for ($i=0;$i<=6;$i++){
if (date("D",mktime(0,0,0,$mes,1,$año))==$semana[$i]){
echo "<td>", date("d", mktime(0,0,0,$mes,1,$año)) ,"</td>";
if ( date("D",mktime(0,0,0,$mes,1,$año))=="Sun" ){
echo "</tr>","<tr>";
break;
}else{
break;
}
break;
}else{
echo "<td>", "</td>" ;
}
}
/////////marco los días subsiguientes////////////////////
for ($j=2;$j<=date("t");$j++){
if ( date("D",mktime(0,0,0,$mes,$j,$año))=="Sun" ) {
echo "<td>", date("d", mktime(0,0,0,$mes,$j,$año)), "</td >", "</tr>", "<tr>";
}else{
echo "<td>", date("d", mktime(0,0,0,$mes,$j,$año)) , "</td>" ;
}
}
echo "</tr>";
echo "</tbody>";
echo "</table>";
?>