Re: need help with foreach()
| From: | Fredrik de Vibe | Date: | Sun, 09 Mar 2003 22:40:38 +0000 |
| Subject: | Re: need help with foreach() | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-26210@lists.php.net to get a copy of this message | ||
haloplayer@hotmail.com (David Rice) writes:
> Okay, i have two arrays, $tips and $staff
>
> $tips has a key "date" (which is the date of the first day of the
> week, the second result in the array has the key of the second day of
> the week etc... ) and the value is a floating point decimal.
>
> $staff also has a key "date" and the value is an integer, the number
> of staff working in one day.
>
> To find out the ammount of tips every staff member is to get we have
> to divide the value of $tips by the value of $staff (when the dates
> are the same)
I guess
while(list($d, $t) = each($tips)){
$res = $t / $staff[$d];
// Do what you need with $res ...
}
would do the trick.
--
--Fredrik
"I cannot and will not cut my conscience to fit this year's fashions."
-- Lillian Hellman