# PHP Break And Continue Statements

In this tutorial, we will be learning about break and continue statements.

***What Are Break Statements?***

To end the entire loop earlier if a particular condition is met, you can use the “break” keyword.

***Example***
```
<?php
for($i=0; $i<100; $i++)
{
if($i==2) {
break;
}
echo $i;
}
?>
```

***Result***
![1.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1634080171199/MPF1uzVdk.png)

The above code will only execute up until `$i==2`. What would have happened when `$i==3`, `$i==4`  etc is completely irrelevant.

In other words, it would not matter whether we had written instead `$i<100`, `$i<10`, `$i<5` or `$i<1000`. The result is the same, since the loop had already been broken when `$i==2`.

***What Are Continue Statements?***

Break will end the entire loop.
If you only want to end the current iteration and not the loop itself, you should use continue instead.
Hence, if instead we wrote:
***Example***
```
<?php
for($i=0; $i<100; $i++)
{
if($i==2) {
continue;
}
echo $i;
}
?>
```

***Result***

![2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1634080177051/dxh6K5dAw.png)

The code for `$i==2` would have stopped executing, and the code will move to the `$i==3` iteration.


