Print message after finished of every task
<p>I know the title of subject not clear, but I will explain what the intended of that title.</p>

<p>Firstly<br>
I have a form contain some fields, and submit button.
That form will make a request to another page <code>upgrade2.php</code> like:  </p>

<pre><code>&lt;form action="upgrade2.php" method="post"&gt;
  &lt;input ......&gt;
  &lt;input ......&gt;
  &lt;input type="submit" name="open_upgrade2" value="ok" /&gt;
&lt;/form&gt;
</code></pre>

<p>Now, the page <code>upgrade2.php</code> has more than task like the following:</p>

<pre><code>&lt;?php
  task 1
  task 2
  task 3
?&gt;
</code></pre>

<p>What I want is after end of every task print message like:</p>

<pre><code>&lt;?php
  task 1
  echo task 1 finished
  task 2
  echo task 2 finished
  task 3
  echo task 3 finished
?&gt;
</code></pre>

<p>I'm tried use <code>sleep</code> ,<code>ob_flush</code> and <code>flush</code> functions to stop execution some time to print message and then continue execution, but unfortunately, the script must execute all taskst in same time and then tell me the result, but this is not what I want.</p>

<p>I want print message after end of every task.</p>
