
Originally Posted by
inductinve soul
<?php
$d=date("D"); if ($d=="Fri") echo "Today is Friday,";
elseif ($d=="Sat") echo "Today is Saturday,";
elseif ($d=="Sun") echo "Today is Sunday,";
elseif ($d=="Mon") echo "Today is Monday,";
elseif ($d=="Tue") echo "Today is Tuesday,";
elseif ($d=="Wed") echo "Today is Wednesday,";
elseif ($d=="Thu") echo "Today is Thursday,";
else echo "How maddening the script has a error!";
?> <?php echo date("F j, Y, g:i a"); ?>
Now the script works... but it would be nice if I didn't have two PHP scripts running. I am actually quite embarrassed that I could not figure out how to combine the two after half an hour of playing around, so any help would be appreciated..
Code:
<?php
$d=date("D"); if ($d=="Fri") echo "Today is Friday,";
elseif ($d=="Sat") echo "Today is Saturday,";
elseif ($d=="Sun") echo "Today is Sunday,";
elseif ($d=="Mon") echo "Today is Monday,";
elseif ($d=="Tue") echo "Today is Tuesday,";
elseif ($d=="Wed") echo "Today is Wednesday,";
elseif ($d=="Thu") echo "Today is Thursday,";
else echo "How maddening the script has a error!";
echo date("F j, Y, g:i a"); ?>
All I did was take out the closing ?> and the new <?php tag near the end; if you start it with <?php anything in the middle is processed as php until you put ?>, so if there's more than one script, put them all in the same <?php ?> brackets.
Edit: Just to clarify though, my opinion is if it works, don't mess with it. I don't think there's much of a performance loss by having too much info.