So, while coding today I came across a very strange bug in PHP. It seems as though subtracting two arrays will return null.
However, if I wrap that in the floor() function, it works as expected.
Go figure. Took me 30 minutes to find that annoying bug.