哪个会更快,哪个是正确的PHP内部if和整数?

I have 2 while loops in an if then else if statement, the code works and all is good, but just a little question.

Take my first example, I declare on the while loop the true statement for it to execute,

if ($levelChange > 0) {
    while ($levelChange != 0) {
        echo '<p>You gained a level you are now ' . ($levelChange + $user['level']) . '</p>';
        $levelChange--;
    }
}
elseif ($levelChange < 0) {
    while ($levelChange != 0) {
        echo '<p>You just lost a level you are now ' . ($levelChange + $user['level']) . '</p>';
        $levelChange++;
    }
}

And my second example I don't,

if ($levelChange > 0) {
    while ($levelChange) {
        echo '<p>You gained a level you are now ' . ($levelChange + $user['level']) . '</p>';
        $levelChange--;
    }
}
elseif ($levelChange < 0) {
    while ($levelChange) {
        echo '<p>You just lost a level you are now ' . ($levelChange + $user['level']) . '</p>';
        $levelChange++;
    }
}

They both work but which one is better to use and why, also if anyone knows which could be faster please enlighten me,

Thanks

PHP converts its arguments to boolean values where a conditional statement is expected. For numbers every non-zero value (!= 0) evaluates to true. The PHP docs for the boolean type have a table with conversion rules for different types.

Therefore, if($x) is equivalent to if($x == TRUE). There isn't any (measurable) performance difference between the two forms.

In this case I would say it's your preference. I would probably use the comparison to 0, but that is just my preference because it is slightly more verbose to someone else reading your code. There shouldn't be much a change in performance either way.