How can I make a PHP counter?

why the extra if into the while? i would do this:

$counter = 0;
while(...)
{
    (...)
    $counter++;
}

echo $counter;

Leave a Comment