0

please look at this code,

for ($count=$num1; $count<=$num2; $count++){
		for ($count1=1; $count1<=2; $count++){
		echo $count1;
		}
	  }

why this is never ending loop ?
when i run this code my browser hanged, why it is happening ??

Edited by Xufyan: n/a

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by Xufyan
0

what are values of, num1 and num2.
Your second loop will never execute. eveyting depends on num1 and num2

0

num1 and num2 are input through the form and num1 is always less than num2.

what are values of, num1 and num2.
Your second loop will never execute. eveyting depends on num1 and num2

0

your $count1 value is always less than 2 because its not incremented anywhere...
I think in your inner for loop you should increment $count1++ instead of $count++

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.