Saturday, December 30, 2017


Prime Number Program in PHP

Prime Number :- 

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. For example, 3 is a prime number because it has no positive divisors other than 1 and 3.

Prime numbers are below:-

2, 3, 5, 7, 11, 13, 17, 19 ....

Here I am writing the PHP program to check whether a number is Prime or not.

function CheckPrime($number){
        if($number%$x == 0){
            return 0;
    return 1;

$a = CheckPrime(17);
if ($a==0)
    echo 'This is not a Prime Number.....'."\n";
    echo 'This is a Prime Number..'."\n";

Output :- This is a Prime Number..

Using the above program you can check whether a number is prime or not in PHP.

About Author -

Hi, I am Anil.

Welcome to my eponymous blog! I am passionate about web programming. Here you will find a huge information on web development, web design, PHP, Python, Digital Marketing and Latest technology.

Subscribe to this Blog via Email :

Note: Only a member of this blog may post a comment.