Hope I don't get into too much trouble but I spotted a very quick way to speed up this code..
You only need to check up to the square root of the number in question, not half the value. Example, if you were checking a number that is roughly a million, that requires your script to do up to 500,000 increments. In reality it only needs to do about 1,000.
Does PHP have a square root function?
Last edited by Cjwinnit; 10-07-2011 at 04:11 PM..