[thelist] First Monday bug...

Tris beertastic at gmail.com
Wed Apr 4 06:41:41 CDT 2007


The clever guy at work, just fixed it:



======================

function showMondays($noWeeksBack = 10, &$dates) {
	$oneDay = 86400;
	$WeekDayNumber = date('w');
	
	for ($i = -1; $i <= $noWeeksBack; $i++) {
		$prevWeeks = $i * 7;
		$prevWeeks = $prevWeeks + 6;
		$tmp = date("Y-m-d",time() - ($WeekDayNumber + $prevWeeks) * $oneDay);
		$dates[$tmp] = date("jS M Y",time() - ($WeekDayNumber + $prevWeeks)
* $oneDay);
	}
	
	return true;
}

	if(showMondays(4, $dates))
	{
		foreach ($dates as $key => $value)
			$showDates .= "<option value=\"" . $key . "\">" . $value. "</option>\n";
	}




======================

On 04/04/07, Jason Handby <jason.handby at corestar.co.uk> wrote:
> > Can a function even output 2 bits of data?
>
> Generally, no.
>
> However, you can get around this by wrapping up the two bits of data
> into one container, and returning that. Or maybe you just have to
> rewrite your code so that you don't need to return more than one thing
> from a function...
>
>
>
> Jason
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>


-- 
When a person can no longer laugh at himself, it is time for others to
laugh at him.
Thomas Szasz



More information about the thelist mailing list