I'm having the following difficultly:
I have a table rates
which contains the follow:
-> id
-> rate_from
-> rate_to
-> price
A user
can have many rates, and for an example:
between 0 - 10 hours the user
charges 10.00
an hour
between 10 - 100 hours the user
charges 20.00
an hour
What I want to do is calculate, let's say that the person has worked 40 hours then it would be the following (10 * 10
+ 30 * 20
)
But the issue is, how can I achieve this using PHP? They could potentially have worked 48.10
for example.