0

While Loop

$x = 0; while($x<=7) { $x++; } echo $x; //output 8 I don't get why the output is * can somebody explain to me pls

21st Jun 2018, 10:55 AM
Danish Lim
Danish Lim - avatar
3 odpowiedzi
+ 3
x=0, x<=7 so increase x x=1, x<=7 so increase x x=2, x<=7 so increase x x=3, x<=7 so increase x . . . x=7, x<=7 so increase x x=8, x <= 7 is incorrect so end while print x that is 8
21st Jun 2018, 11:15 AM
🇮🇷 M N
0
so its about where i put the echo?
21st Jun 2018, 11:21 AM
Danish Lim
Danish Lim - avatar
0
echo only display the var value.. The important its whicj value has that var when its displayed
21st Jun 2018, 11:36 AM
KrOW
KrOW - avatar