Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does flush command do?

Tags:

php

What do you mean by

"I would do it after you've sent everything to the client and flushed it."

ThankinG you

like image 200
5416339 Avatar asked Dec 07 '22 01:12

5416339


1 Answers

Flushing is the operation involved when there is buffering over streams of data.

Let's assume a normal stdout stream. Printing every byte as soon as it arrives would be inefficient, that's why output is usually buffered and 'flushed' out in chunks. This reduces the overhead of doing this kinds of operations.

So what that sentence means is that he would do it just when data has been prepared to be sent and already effectively sent by flushing the buffer out.

Usually this operation is transparent to the developer, you can force a flush but you don't explicitly need to do it.

like image 145
Jack Avatar answered Dec 28 '22 00:12

Jack