Hello:
I have created an application system for a human resources department. They are interested in finding out how many people per week have submitted an application. I figured this would be fairly straight forward to code, but it seems to have turned into a monster and I figured that there must be an easier way to do this.
This is my setup:
as part of the application I collect a time stamp for submit date. Using the strftime('%U',$date) function I determine the week that each application in the system was submitted.
This is where it gets out of hand:
Then I use a bunch of if statements to determine what number week that application is in and place it into an array for that week. for example:
$test = strftime('%U',$date);
if($test == "1") { $a[] = $id; }
if($test == "2") { $b[] = $id; }
if($test == "3") { $c[] = $id; }
if($test == "4") { $d[] = $id; }
if($test == "5") { $e[] = $id; }
if($test == "6") { $f[] = $id; }
etc. for 52 weeks
then to determine if an array exists and if so, how many applications for each week using the count() function.
This works okay, but It is limited on whether or not an array exists and it seems a bit cumbersome.
would anybody know a cleaner faster way to do this?
Thanks for any feedback