First of all: the used algorithm passed '1' for a prime while it isn't! A prime should have two and only two
different integer divisors...
Secondly, you could speed things up a little more: you only need to check all integer numbers up to ceil( $input / 2 ) because of the commutative properties of integers (2*3 == 3*2).
Furthermore, prime are always (except for '2', so almost always) odd numbers, so you could skip them in your test for even more speed improvement!
-- JaWi
"A chicken is an egg's way of producing more eggs."