# Tandem whiles

**URL:** <https://forum.kirupa.com/t/tandem-whiles/325081>\
**Category:** Uncategorized\
**Created:** [September 25, 2011, 1:53pm UTC](https://forum.kirupa.com/t/tandem-whiles/325081 "2011-09-25T13:53:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![radi](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@radi](https://forum.kirupa.com/u/radi)\
**Post date:** [September 25, 2011, 1:53pm UTC](https://forum.kirupa.com/t/tandem-whiles/325081/1 "2011-09-25T13:53:08Z")

</div>

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]

```auto

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

```

[/SIZE]

```auto

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
