I am not sure exactly which bit you are stuck on but make sure you deal with ALL cases.
In other words something like:
(1) Suppose the customer borrows before the peak rate starts, but returns before the peak rate starts.
(2) Suppose the customer borrows before the peak rate starts, but returns after the peak rate starts, but before it ends.
(3) Suppose the customer borrows before the peak rate starts and returns after the peak rate ends.
(4) Suppose the customer borrows during the peak rate period and returns during the peak rate period.
(5) Suppose the customer borrows during the peak rate period and returns after the end of the peak rate period.
(6) Suppose the customer borrows during the period after the peak rate and ends the loan after the peak rate.
(7) Suppose the loan occurs over 1 day, 2 days, more than 2 days.
In each case make sure you test the condition, use an if statement (not sure how that works in PHP), and does the right
thing in each and every case. The time periods concerned can be done by simply (end time of section - start time of section) in
seconds, and then converted by a factor if needed, remembering to add together all of the chunks if appropriate, if there is only
one piece of time then it is just the one bit, but if there are several then I'm afraid you have go through them somehow and add them.
No maths function is really going to help. So a computer program is needed using if constructs, procedures, method calls,
(or whatever is used in PHP) or whatever is appopriate in the language(s) used.
I suggest setting up variables and constants with meaningful identifiers for ALL of the relevant things to do with time
and rate of charge for each printer.
I am not sure whether you realised that the time stamps appear to be seconds since 01/01/1970.
I apologise if any of that is wrong so double check all of it if it is for a serious purpose like a real business or serious Computer studies.