PHP adding threshold to prime generator