11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.it-ebooks.infoCHAPTER 3 • <strong>PHP</strong> BASICSThe break and goto StatementsEncountering a break statement will immediately end execution of a do...while, for, foreach, switch,or while block. For example, the following for loop will terminate if a prime number is pseudo-randomlyhappened upon:Sample output follows:Non-prime number found: 48Non-prime number found: 42Prime number found: 17Through the addition of the goto statement in <strong>PHP</strong> 5.3, the break feature was extended to supportlabels. This means you can suddenly jump to a specific location outside of a looping or conditionalconstruct. An example follows:It produces the following (your output will vary):Number greater than 10: 22Number greater than 10: 2185

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!