Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php exit foreach

$arr = array('one', 'two', 'three', 'four', 'stop', 'five');
foreach ($arr as $val) {
    if ($val == 'stop') {
        break;    /* You could also write 'break 1;' here. */
    }
    echo "$val<br />
";
}

/* Using the optional argument. */

$i = 0;
while (++$i) {
    switch ($i) {
        case 5:
            echo "At 5<br />
";
            break 1;  /* Exit only the switch. */
        case 10:
            echo "At 10; quitting<br />
";
            break 2;  /* Exit the switch and the while. */
        default:
            break;
    }
}
?>

Comment

PREVIOUS NEXT
Code Example
Php :: cut string in php 
Php :: laravel validation unique email 
Php :: group by laravel 
Php :: set subject for mail inlaravel 
Php :: php nested array contains 
Php :: laravel controller return message 
Php :: php newline 
Php :: get product category url woocommerce 
Php :: wp show logo 
Php :: laravel if request has 
Php :: http error 500 phpmyadmin 
Php :: whereyear laravel 
Php :: check if array has value php 
Php :: merge two objects in php 
Php :: php changr date format 
Php :: php copy url 
Php :: Hide all updates from WordPress 
Php :: php implode as key value of object 
Php :: php check if extension is installed 
Php :: laravel json response decode 
Php :: laravel redirect back with input 
Php :: how to switch from php7.4 to php7.3 mac 
Php :: Internal error: xmlSchemaDocWalk, calling xmlSchemaValidateElem(). 
Php :: wordpress post excerpt from post id 
Php :: install phpunit on ubuntu 18.04 
Php :: php transform associative array to array 
Php :: qual é a melhor linguagem de programação para iniciantes 
Php :: php filter name 
Php :: php artian migrate table 
Php :: wordpress disable posts 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =