5416339
5416339

Reputation: 417

What does flush command do?

What do you mean by

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

ThankinG you

Upvotes: 4

Views: 3899

Answers (5)

The Surrican
The Surrican

Reputation: 29874

flush prints out any buffered output to the client. everything you print out first goes into a buffer. you can also turn on explicit buffering if you want, so that nothing gets to the client but you can store it in the buffer for post editing of a website or something. flush ensures that everything in the buffer is sent to the client.

Upvotes: 3

JAL
JAL

Reputation: 21563

This can mean a couple of different things, depending on the context. I'm assuming you mean flushing an outbut buffer.

An output buffer is where output is stored temporarily before being sent to a client all at once. Flushing means to send the stored data to the client. See the docs for ob_flush.

Upvotes: 0

Jack
Jack

Reputation: 133669

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.

Upvotes: 10

fabrik
fabrik

Reputation: 14375

flush

Flush the output buffer

So in my read it means when you delivered the webpage to clients' browser.

Upvotes: 1

Raoul Duke
Raoul Duke

Reputation: 4311

http://php.net/flush

Flushes the write buffers of PHP and whatever backend PHP is using (CGI, a web server, etc).

Upvotes: 2

Related Questions