PHP flush and DIV – strange behavior

hi,


The flush() command is not working if I have opened DIV which contains another DIV.


The script version 1 (below) display “e” then sleeping and displays the rest of the characters.

If I close the first DIV, I get “eaa” before sleep (version 2).

If I comment out the DIV, I get the same as version 2.


Version 1:——————————–

<?PHP ob_implicit_flush(true); ob_end_flush(); ?>

e<div>a<div>a</div>

<?PHP sleep(5); ?>

<div>b</div>

<?PHP sleep(5); ?>

c</div>

Version 2:——————————

<?PHP ob_implicit_flush(true); ob_end_flush(); ?>

e<div>a<div>a</div></div>

<?PHP sleep(5); ?>

<div>b</div>

<?PHP sleep(5); ?>

c</div>

Version 3:——————————

<?PHP ob_implicit_flush(true); ob_end_flush(); ?>

e<div>a<div>a</div><!–</div>–>

<?PHP sleep(5); ?>

<div>b</div>

<?PHP sleep(5); ?>

c</div>

—————————–


Can you tell me the cause of this strange behavior and how can I fix it?

You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply

You must be logged in to post a comment.