Re: need help with foreach()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux