Not sure where you go wrong reading his code, but since I started responding I might as well give you a quick explanation: he's flooring the time divided by seconds, minutes and 24 hours, so yeah it's converted to full days. Then he's calculating the difference in days between his start date and the current date and putting the resulting difference in days into $check_time, on which he is then performing a modulus operation with respect to the 19 array elements to determine how many days we are into the current 19 day cycle. Mathematically the result of that can never be greater than 18.
PS: Disclaimer: I've got nothing to do with the code in the OP, hope Drums you don't mind that I'm explaining your code...