for loop - PHP - Break after return? -


Do I need to use a break here or will it stop stopping and should be back only once? Returned incorrectly to {

  ($ I = 0; $ i & lt; 5; $ i ++); // break; }   

Thanks!

This will run only once, stop planting and exit the function / method.

It can be argued that this is a bad style return later, which is bad for debugging and maintenance, it is very easy to ignore. Using

break may be cleaner: ($ i = 0; $ i <5; $ i ++) {if ($ var [$ i] === '') {set_some_condition; break; }} If (some_condition) returns;

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -