Put the output of `count($keys)` in a variable. Otherwise this will be called each iteration of the for loop