note 13731 deleted from function.date by jimw
| From: | jimw@php.net | Date: | Fri, 02 Nov 2001 01:10:25 +0000 |
| Subject: | note 13731 deleted from function.date by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20088@lists.php.net to get a copy of this message | ||
This is pretty much useless, but it illustrates at least one powerful feature of Php. Call it from
your HTML thus: echo gday();
---- begin
function gday() {
$now=date("G");
if (($now == 0)||($now == 24))
{return "Tis the stroke of Midnight!\<BR\>";}
elseif ($now >= 17)
{return "Good evening.\<BR\>";}
elseif (($now >= 12)&&($now < 17))
{return "Good afternoon.\<BR\>";}
else
{return "Good morning.\<BR\>";}
}
----end
I've used back-slashes to escape the > stuff to make it easier to read. You could easily
replace the returned strings with images ...
Php is way cool.