Write a php program to accept a number from the user and print whether it is prime or not

Write a php program to accept a number from the user and print whether it is prime or not. This script is helps you to find whether the number is prime or not. To print the number whether the number is prime number or not prime number in php programming language

 <?php 
$x = 0; 
$number = 2; 
while ($x < 10 ) 
{ 
$div_x=0; 
for ( $i=1; $i<=$number; $i++) 
{ 
if (($number%$i)==0) 
{ 
$div_x++; 
} 
} 
if ($div_x<3) 
{ 
echo $number." , "; 
$x=$x+1; 
} 
$number=$number+1; 
} 
?> 

Output:

2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29