How would I put together a PHP5 function that would find the current calendar week and return the dates of each day in the week as an array, starting on Monday? For example, if the function were run today (Thu Feb 25 2010), the function would return an array like:
[0] => Mon Feb 22 2010
[1] => Tue Feb 23 2010
[2] => Wed Feb 24 2010
[3] => Thu Feb 25 2010
[4] => Fri Feb 26 2010
[5] => Sat Feb 27 2010
[6] => Sun Feb 28 2010
It doesn't matter what format the dates are stored as in the array, as I assume that'd be very easy to change. Also, it'd be nice to optionally be able to supply a date as a parameter and get the calendar week of that date instead of the current one.
Thanks!