+ 2
Can somebody explain me a php code please?
The given code is: $x=1; While($x<10){ Echo $x; $x=$x + 3; } The result is 147. All i want to know is the steps to get to that result. Thank you
3 Réponses
+ 6
In first iteration x value is 1 , hence while condition stands true and print 1 and increase x value by 3 means now x value is 4.
Again condition stands true , it prints 4 and increase x value by 3 means now x value is 7.
Again condition stands true , it prints 7 and increase x value by 3 means now x value is 10.
Now 10 < 10 stands false and hence output will be
147
Hope this helps ☺️☺️.
+ 2
right. understood now. thanks a lot :)
+ 1
Happy that helped☺️☺️.