Skip to content

Instantly share code, notes, and snippets.

@johndugan
Created October 5, 2012 02:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johndugan/3837726 to your computer and use it in GitHub Desktop.
Save johndugan/3837726 to your computer and use it in GitHub Desktop.
PHP: for loop with break
// 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