NOTE: This invite-only release of SunSed Alpha is for testing purposes and in no way represents the final quality of the product — join the waitlist (~wait time: 2 weeks). SunSed release date is on March 11, 2022.

BREAK

The break statement is used to jump out of a loop completely.

Example

The following code looks for the first user that is inactive, print the users name and then breaks out of the loop.

$users = [
    [
        "id" => "31294",
        "status" => "active",
        "name" => "Alex Garcia"
    ],
    [
        "id" => "90453",
        "status" => "inactive",
        "name" => "Alex Garcia"
    ],
    [
        "id" => "42271",
        "status" => "active",
        "name" => "Alex Garcia"
    ],
]

FOREACH ($users AS $user) {
    IF($user['active'] === 'inactive') {
        :: $user['name']
        BREAK
    }
}
Copyright © SunSed LLC 2013-2021 All rights reserved.