LMSouq
general-dev Open

break out of if and foreach

AU
au_stan
1 month ago
3 views
Problem Description
I have a foreach loop and an if statement. If a match is found I need to ultimately break out of that foreach and if. foreach($equipxml as $equip) { $current_device = $equip->xpath("name"); if ($current_device[0] == $device) { // found a match in the file $nodeid = $equip->id; // <break out of if and foreach here> } }

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base