protected function isPrimeNumber($number)
    {
        $number = \abs($number);

        // 2 is an exception.
        if (2 === $number) {
            return true;
        }

        // Check if number is even.
        if (!($number & 1)) {
            return false;
        }

        $sqrtNumber = \sqrt($number);
        for ($divisor = 3; $divisor <= $sqrtNumber; $divisor += 2) {
            if (0 === $number % $divisor) {
                return false;
            }
        }

        return true;
    }
protected function isPrimeNumber($number)
    {
        $number = \abs($number);

        // 2 is an exception.
        if (2 === $number) {
            return true;
        }

        // Check if number is even.
        if (!($number & 1)) {
            return false;
        }

        $sqrtNumber = \sqrt($number);
        for ($divisor = 3; $divisor <= $sqrtNumber; $divisor += 2) {
            if (0 === $number % $divisor) {
                return false;
            }
        }

        return true;
    }
protected function isPrimeNumber ( $ number ) { $ number = \ abs ( $ number ) ; // 2 is an exception. if ( 2 === $ number ) { return true ; } // Check if number is even. if ( ! ( $ number & 1 ) ) { return false ; } $ sqrtNumber = \ sqrt ( $ number ) ; for ( $ divisor = 3 ; $ divisor <= $ sqrtNumber ; $ divisor += 2 ) { if ( 0 === $ number % $ divisor ) { return false ; } } return true ; }
Test if a number is prime or not.

@param int $number
The number to test

@return bool
The true if the number is prime, false otherwise
Test if a number is prime or not .