# PHP Program to Check Prime Number

## What is Prime Number?

A positive integer that is divisible only by itself and 1.

**Tips**: It is recommended to use our online Prime Numbers calculator for better understanding.

## Examples

The following table provides few examples of prime numbers.

Number | Divisor | Result |
---|---|---|

13 | 1, 13 | Prime Number |

15 | 1, 3, 5, 15 | Not a Prime Number |

47 | 1, 47 | Prime Number |

## Using for loop

In the following example, we will check whether the given number (7) is a Prime number or not using for loop.

### Example

### Output

## Using while loop

In the following example, we will check whether the given number (7) is a Prime number or not using while loop.

### Example

### Output

## Using do while loop

In the following example, we will check whether the given number (7) is a Prime number or not using do while loop.

### Example

### Output

## Prime Numbers between the Given Range

In the following example, we will find all the Prime numbers between 1 and 20.

### Example

### Output

## Check Whether the Given Number is Prime or Composite

In the following example, we will check whether the given number is a Prime number or Composite number.

### Example

### Output

## Reminder

Hi Developers, we almost covered 90% of **String functions and Interview Question on PHP** with examples for quick and easy learning.

We are working to cover every Single Concept in **PHP**.

Please do google search for:

## Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.