I am new to programming and this is not clear to me:
for ($i = 0; $i < 10; $i++) { echo $i; sleep(2); } According to my idea, on the screen first would appear 0, then after two seconds 1 and every two seconds a new number and so on to 10. But they did not appear, 20 seconds passed and only after that all the numbers appeared simultaneously. I would like you to explain why this behavior of the sleep () function and the delay functions in general (in jquery delay (), sort of). I heard that this is somehow related to streams, buffers and other things, but please understand the newcomer in plain language about what these buffers are, what these streams are and how they are related to delay functions in programming. Thank you very much.
for ($i = 0; $i < 10; $i++) { echo $i; flush(); sleep(2); }for ($i = 0; $i < 10; $i++) { echo $i; flush(); sleep(2); }for ($i = 0; $i < 10; $i++) { echo $i; flush(); sleep(2); }and this is why it hangs with this performance ..... - Alexey Shimanskyob_start. Suppose my buffer value out of the box is4096. If you set the valueoffthen theflushwill work like in the console! By the way, I will answer immediately to a parallel question about the console. Yes, you have a buffer, but in the console it automatically loses its power to the valueoff- MaximPro