PHP: for loop with break
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If "i" is equal to 10, break out of the loop and ignore the echo statement below. | |
<?php | |
for($i=0; $i<=10; $i++) { | |
echo $i; | |
if($i==10) { | |
break; | |
} | |
echo ", "; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment