How can I make a PHP counter?

Viewed 75056

I know I have done this in Javascript once, but how can I make it in PHP? Basically I want to do this:

if (empty($counter)){
   $counter = 1;
}else{
   "plus one to $counter" ($counter++?)
}

But it didn't work when I tried. How would I go about doing this?

Thank you :)

EDIT: This is so I can do:

if ($counter == 10){
   echo("Counter is 10!");
}

EDIT:

This is all in a "while()" so that I can count how many times it goes on, because LIMIT will not work for the query I'm currently doing.

3 Answers
Related