Re: Re: Week calculating

From: Date: Tue, 13 Jan 2004 13:38:29 +0000
Subject: Re: Re: Week calculating
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-174438@lists.php.net to get a copy of this message
On Tuesday 13 January 2004 21:29, nabil wrote: > sorry but what do u think about this ? > > <?php > for ($j=1;$j<13;$j++) { > for ($i=1;$i<32;$i++) { > $mk = mktime(0, 0, 0, $j, $i, 2004); > $datex = date ("l", $mk); > $daterest = date ("j/n/Y", $mk); > if ($datex == "Tuesday") { > echo $datex.">>>>>".$daterest."<br>"; > } > } > } > ?> You don't need the nested for-loop. Just a single loop to increment the 'day', going from, say, 1 to 366 would do. mktime() will take care of the month automatically. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* I'm also pre-POURED pre-MEDITATED and pre-RAPHAELITE!! */

« previous php.general (#174438) next »