Join Up!
104887 members and counting!

 
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previousforeachcontinuenext
Last updated: Sun, 27 Oct 2002
view the printer friendly version or the printer friendly version with notes or change language to Finnish | German | Spanish

break

break ukončuje provádění aktuálního konstruktu for, foreach while, do..while nebo switch.

break akceptuje nepovinný číselný argument, který říká, z kolika vnořených struktur se má vyskočit.

$arr = array ('jedna', 'dvě', 'tři', 'čtyři', 'stop', 'pět');
while (list (, $val) = each ($arr)) {
    if ($val == 'stop') {
        break;    /* Tady byste mohli napsat také 'break 1;'. */
    }
    echo "$val<br>\n";
}

/* Použití nepovinného argumentu. */

$i = 0;
while (++$i) {
    switch ($i) {
    case 5:
        echo "Při 5<br>\n";
        break 1;  /* Ukončuje pouze switch. */
    case 10:
        echo "Při 10; konec<br>\n";
        break 2;  /* Ukončuje switch a while. */
    default:
        break;
    }
}

User Contributed Notes
break
add a note about notes
There are no user contributed notes for this page.
previousforeachcontinuenext
Last updated: Sun, 27 Oct 2002
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: http://phpbuilder.com/
Last updated: Thu Oct 31 18:34:28 2002 EST