How do I delete the last echo in a while loop?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cap2cap10
Forum Contributor
Posts: 158
Joined: Mon Apr 14, 2008 11:06 pm

How do I delete the last echo in a while loop?

Post by cap2cap10 »

Hello again, php Technorati. Here is my problem i want to see a number for each time a function is performed.
Hence I did a $count++ and echo $count in a while loop. Now How do I delete the last $count echoed so that I will see numbers that increase, instead of a list of numbers representing each time the function was performed?

Code: Select all

 
While loop;{
 
$count++;
 
echo $count;
 
delete $count?????????????
}
 
Pleas show me the way.

As always, thanks in advance,


Batoe

Many obstacles and obstructions lie in the path, but so does success! The unkown Optimist
Last edited by Benjamin on Mon Feb 22, 2010 8:57 pm, edited 1 time in total.
Reason: Added [code=php] tags.
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Re: How do I delete the last echo in a while loop?

Post by jraede »

You're going to have to explain this a little better...I have no idea what you're trying to do.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: How do I delete the last echo in a while loop?

Post by pickle »

It seems like he wants a progress bar-type-thing.

So he sees:

1

then just

2

then just

3

instead of

1 (then a little while later) 2 (then a little while later) 3, resulting in "123"

Short answer - you can't with just PHP. You can, in your function, output Javascript that then acts on the rendered DOM & updates a div's content.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply