List Prime Numbers

List all prime numbers until the number that you enter.

Start Over

Results:

The PHP code behind it

Here is the PHP function to check if a number is a prime number. It returns true if the number is a prime number, otherwise it returns false.

function isa_is_prime( $num ) {
	$isPrime = true; 
	for ($i = 2; $i <= $num/2; $i++) {
		if ($num % $i == 0) {
			$isPrime = false;
			break;
		}
	}
	return $isPrime;
}

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]