Tandem whiles

im trying to use two while loops going threw the same array, the idea is, if its a string just echos the string otherwise add values from two other like arrays im sure if i just added a else the issue would be resolved however i would like for the number and string values to be separate. The while loop that is second gets ignored( i changed there order around and only the first loop functions so i know the problem doesn’t have anything to do with the loops them self’s)
[SIZE=2]


while (list($key, $value) = each($mods["S"])) {if(is_string($value) == true){echo $key;echo " =X= ";echo $mods["S"][$key]."<br />";}}

[/SIZE]


unset($key);
unset($value);
while (list($key, $value) = each($mods["S"])) {if(is_string($value) == false){echo $key;echo " =x= ";echo $mods["S"][$key] + $mods2["S"][$key] - $mods3["S"][$key]."<br />";}}

i changed the type of loop to foreach, and it fixed its self