views:

143

answers:

3

Hi, can I put a for loop in while loop? For example:

while($end = 1)
{
  for ($i = 0; $i < count($match); $i++)
  {
    $mathcas = $match[$i][1];
  }
}

Thanks. :)

A: 
Traveling Tech Guy
Actually, even if he does change `$end` inside the loop, it'll still be infinite. :o)
deceze
Indeed, `=` vs. `==` strikes again!
Amber
Good point :) VS won't let you fall for that anymore :)
Traveling Tech Guy
A: 

yes you can. though in the example you gave the outer while loop will either never end or never run

Am
+2  A: 

While it is perfectly possible, I strongly recommend avoiding the particular construct you are trying...

If you find the element you are lloking for, just break the for loop and you will be done!

Edit: and please use == for comparisons!!!

Pablo Rodriguez
+1 well spotted
iAn