I have array like this that i produce using for loops. I want to break the loops, when they have value "AM", How could i do that ?
Array
(
[0] => A
[1] => B
[2] => C
[3] => D
[4] => E
[5] => F
[6] => G
[7] => H
[8] => I
[9] => J
[10] => K
[11] => L
[12] => M
[13] => N
[14] => O
[15] => P
[16] => Q
[17] => R
[18] => S
[19] => T
[20] => U
[21] => V
[22] => W
[23] => X
[24] => Y
[25] => Z
[26] => AA
[27] => AB
[28] => AC
[29] => AD
[30] => AE
[31] => AF
[32] => AG
[33] => AH
[34] => AI
[35] => AJ
[36] => AK
[37] => AL
[38] => AM
[39] => AN
[40] => AO
[41] => AP
...
[726] => ZZ
)
This is my syntax
$alp = range("A","Z");
$hit = count(range("A","Z"));
for($i=0; $i < count(range("A","Z")); $i++) {
for ($i2=0; $i2 < count(range("A","Z")); $i2++) {
$alp[$hit++] = $alp[$i].$alp[$i2];
if($alp[$hit] == "AM"){
break;
}
}
$hit++;
};
I got an error, like undefined offset and such until the end of looping, how could i break all the loop when i break the loop inside a loop ?