Yup, we can add:
PHP Code:
if ($counter < 2)
{
$counter = 2;
}
$counter = floor($counter);
after ++counter;
Of course, you can put the
floor into some checking, so it won't be executed each time; it's up to you. Same with $counter checking - if you'll be factorising numbers by yourself, you won't provide it with incorrect arguments, however, when making it public, Itsacon is right, be careful about varibles.