Break in PHP

Each case is closed with the break instruction that, when executed, immediately causes us to exit the execution of the switch; if that break was not at the end of each case, once a true case was found and its sentences were executed, the questions of the other cases would continue to be unnecessarily executed, losing time without necessity.

Break in PHP | Learn PHP | Each case is closed with the break instruction that, when executed, immediately causes us to exit the execution of the switch; if that break was not at the end of each case, once a true case was found and its sentences were executed, the questions of the other cases would continue to be unnecessarily executed, losing time without necessity

Break in PHP (exit the switch)

Each case is closed with the break instruction that, when executed, immediately causes us to exit the execution of the switch; if that break was not at the end of each case, once a true case was found and its sentences were executed, the questions of the other cases would continue to be unnecessarily executed, losing time unnecessarily.

But what is worse, the default would be executed (which would not have to be executed if a true case was already executed, remember that the default is that it is executed only if all the cases were false).

Now that we know the conditional (if, else, elseif) and selective (switch) structures, we will deepen the complementary tools of these structures, which will allow us to validate the data of our forms with the greatest precision. The main complementary tools are the comparison operators and the logical operators, which we will learn next.

Did you like it or was it useful?

Help us share it in Social Networks

Professor at the University of Guadalajara

Hugo Delgado Desarrollador y Diseñador Web en Puerto Vallarta

Professional in Web Development and SEO Positioning for more than 10 continuous years.
We have more than 200 certificates and recognitions in the Academic and Professional trajectory, including diploma certificates certified by Google.

IT ALSO DESERVES TO PAY TO VISIT:

PREVIOUS


Switch in PHP

Not finding what you need?

Use our internal search to discover more information
Sponsored content:
 

Leave your Comment

SPONSOR

Your business can also appear here. More information