2
i have a foreach inside another foreach that will run for various values of a specific object. But I need to stop the two foreach’s when it goes inside the if, however the command break
does not work for some reason, it just keeps running the two foreach’s. The code is more or less like this:
foreach($conteudo["data"] as $oddss) {
foreach($oddss["types"]["data"] as $oddss2) {
if($oddss2["type"] == "1x2") {
$bookmarker = $oddss["bookmaker_id"];
foreach($oddss2["odds"]["data"] as $oli) {
switch($oli["label"]) {
case 1:
$cotCasa = $oli["value"];
break;
case 2:
$cotFora = $oli["value"];
break;
case "X":
$cotEmp = $oli["value"];
}
}
break;
}
}
}
I don’t quite understand, is
break
where theswitch
. In the} break;}
placebreak 2;
see if this is the desired result.– rray
That’s exactly what I needed. I didn’t know there was such a break 2. Thank you!
– Krint
It can be any number just can’t be a variable :)
– rray
All right, thanks a lot!!
– Krint