...if it works it returns 1.
Not necessarily. The operation itself returns a value (in the case of your example 5, not 1), which is what the conditional evaluates rather than the "success" of the operation. For example, if the result of the assignment is 0:
$i = 5;
while ($x = $i--) {
echo $x . '<br />';
}
The loop is exited at zero, and "0" isn't displayed, since it is evaluated as false. The same would be true of an empty string, a null type (i.e. NULL), and even an empty array.
Add-on: This code shows that any operation returns its value:
$x = 5;
while (1 * --$x) {
echo $x . '<br />';
}
Again the loop exits when the operation returns zero.