Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > ebb1914cf182a88528b4547490db1dd8 > files > 405

kdewebdev-quanta-doc-3.5.9-2mdv2008.1.x86_64.rpm

<HTML
><HEAD
><TITLE
>break</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="manual.html"><LINK
REL="UP"
TITLE="Control Structures"
HREF="control-structures.html"><LINK
REL="PREVIOUS"
TITLE="foreach"
HREF="control-structures.foreach.html"><LINK
REL="NEXT"
TITLE="continue"
HREF="control-structures.continue.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="control-structures.foreach.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 11. Control Structures</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="control-structures.continue.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="control-structures.break"
><TT
CLASS="literal"
>break</TT
></A
></H1
><P
>&#13;    <TT
CLASS="literal"
>break</TT
> ends execution of the current
    <TT
CLASS="literal"
>if</TT
>, <TT
CLASS="literal"
>for</TT
>,
    <TT
CLASS="literal"
>while</TT
>, or <TT
CLASS="literal"
>switch</TT
>
    structure.
   </P
><P
>&#13;    <TT
CLASS="literal"
>break</TT
> accepts an optional numeric argument
    which tells it how many nested enclosing structures are to be
    broken out of. 
   </P
><P
>&#13;    <DIV
CLASS="informalexample"
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>  1&nbsp;
  2&nbsp;$i = 0;
  3&nbsp;while ($i &#60; 10) {
  4&nbsp;    if ($arr[$i] == "stop") {
  5&nbsp;        break;  /* You could also write 'break 1;' here. */
  6&nbsp;    }
  7&nbsp;    $i++;
  8&nbsp;}
  9&nbsp;
 10&nbsp;/* Using the optional argument. */
 11&nbsp;
 12&nbsp;$i = 0;
 13&nbsp;while ( ++$i ) {
 14&nbsp;    switch ( $i ) {
 15&nbsp;    case 5:
 16&nbsp;        echo "At 5&#60;br&#62;\n";
 17&nbsp;        break 1;  /* Exit only the switch. */
 18&nbsp;    case 10:
 19&nbsp;        echo "At 10; quitting&#60;br&#62;\n";
 20&nbsp;        break 2;  /* Exit the switch and the while. */
 21&nbsp;    default:
 22&nbsp;        break;
 23&nbsp;    }
 24&nbsp;}
 25&nbsp;     </PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
   </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="control-structures.foreach.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="manual.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="control-structures.continue.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><TT
CLASS="literal"
>foreach</TT
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="control-structures.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><TT
CLASS="literal"
>continue</TT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>