close

[Solved] Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”

I am facing the following error in the PHP project: Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2” in PHP. In this Exerror article, We are going to learn about How to reproduce this error and we will discuss All Possible Solutions Lets Get Start with This Article.

How Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2” Error Occurs?

I am facing the following error in the PHP project.

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"

So here I am writing all the possible solutions that I have tried to resolve this error.

How To Solve Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2” Error?

  1. How To Solve Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2” Error?

    To Solve Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2” Error This error is defined in PHP 7.3 With Backward Incompatibility As Per PHP Official Document continue statements targeting switch control flow structures will now generate a warning. In PHP such continue statements are equivalent to break, while they behave as continue 2 in other languages. By Downgrading to php7.2 will resolve your error. and now your error will be solved. Thanks.

  2. Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”

    To Solve Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2” Error You Just need to Update your composer by running composer update and then your error will be resolved. This error usually occurs when your composer is not updated so You Just need to update the composer using this command: composer update You can also run the composer install command: composer install OR run this command: composer self-update And now, Your error must be resolved. Thank you.

Solution 1: Update Composer

To Solve Warning: “continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2” Error You Just need to Update your composer by running composer update and then your error will be resolved. This error usually occurs when your composer is not updated so You Just need to update the composer using this command.

composer update

You can also run the composer install command.

composer install

OR run this command.

composer self-update

And now, Your error must be resolved. Thank you.

Solution 2: Downgrade PHP

This error is defined in PHP 7.3 With Backward Incompatibility As Per PHP Official Document continue statements targeting switch control flow structures will now generate a warning. In PHP such continue statements are equivalent to break, while they behave as continue 2 in other languages.

By Downgrading to php7.2 will resolve your error. and now your error will be solved. Thanks.

Conclusion

It’s all About this error. I hope We Have solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment