Going by the comments of OP, I'm going to assume OP wants a timer on the command line and presume the <br>
was meant to convey a newline.
A timer on the command line, which clears the line every tick, could be construed as follows:
for( $i = 0; $i < 100; $i++ ) {
/*
the \r moves the cursor back to the start of the line
the additional spaces are there to make sure
any additional digits are removed as well
adjust the amount of spaces to the max amount of digits
(which is actually only useful if the timer was counting down, in stead of counting up)
*/
echo "$i \r";
// wait a second
sleep( 1 );
}
ob_*
functions are of no use here; they are merely meant as an internal buffer for PHP, before it sends the output. You can't clear what's already been sent out.
If you want to completely clear the screen as well, I suggest to look at the suggestions in this question and related questions.
However, if you are outputting through a web server and viewing the result in a web browser, you are out of luck. You can't clear the output you have sent to a web browser, in the way you intend, because the web is a client <-> server
architecture. You'll have to understand this architecture and use something like AJAX, websockets, or perhaps long polling.
` in your code appears to suggest you want to output HTML. Are you sure it's intended for the [command line](https://secure.php.net/manual/en/features.commandline.introduction.php) and not served through a webserver, like Apache? – Decent Dabbler Apr 21 '17 at 20:06
" because now I have one under the other. If you can tell me, how I can clean everything what was printed on the screen before current key of for loop - I don't need this "
" tag. – Majkson Apr 21 '17 at 20:12