PHP Program to Find Prime Series

In this post I am describing the PHP Program which tell us about how to find prime number Series. Prime number are those number which are divisible by 1 and themselves. In this program we are using for loop, if condition and break statement.
 $number= $_POST['number'];
 for($i=2;$i<=$number;$i++){  //loop for numerator
   for($j=2;$j<=$number;$j++){  //loop for denominator
     if($i<=$j){ //checking weather the value of denominator is greater then or equal to numerator
	echo $i.","; //if this condition is true then the numerator is prime.
     if($i%$j==0){//this condition checks weather the numerator is divisible by denominator
		<title>Prime Series</title>
		<form action="" method='POST'>
		<label for="number">Please Enter Length of series</label>
		<input type="text" name="number" value="">
		<input type="submit" value="Done" name="submit">

Program Output:

Stay tuned for the PHP Magento, WordPress and Magento2 latest tutorial and updates, Hope you enjoyed reading, if you need the professional Magento Development / PHP we can help you, just Click on the Link and send me your requirements.

Please Like the Post on Facebook or Google+.