My advice: don't do it this way.
Instead, turn $item into an array.
like if you said:
$item = 5432;
$item1 = 3334;
$item2 = 9980;
you could instead say:
$item[] = 5432;
and so on. each time you want to assign something to the end of the array, just use empty brackets. ($item[]) or if you want to assign to a specific node of the array, just do it ($item[2] = 9980).
then, instead of using a while loop, you can use an easy foreach:
foreach ($item as $value){
do something to $value;
}
may not seem easy if you don't know much about arrays, but it's sooooo much cleaner.