Function that determines prime numbers in PHP