Question: Ok, This has been playing my head for a while now - and I know it's simple....but tiredness is supplying me with a mental block...hope you guys can help!

I have this long string which which i have exploded into an array:

```
Array
(
[0] => 15896,10
[1] => 15897,10
[2] => 15898,1
 .....(to [95] =>)

```

Now what I want to do is iterate through each line of the array, and put the 15896 numbers into one text box, and the 10 into a separate text box. 

Annoyingly I've done something like this before on a previous application, although I can't seem to apply the same syntax across (Last time i had a 2d array, and iterated through with 2 foreach loops....

Thanks in advance!

Current Code: 

```
$getString = mysql_query("SELECT orderString FROM stock_orders WHERE orderID    ='".$_GET["type"]."'");
while($row = mysql_fetch_array($getString)){
$order = $row["orderString"];
}
$newArray = array();

$newArray = explode(" - ", $order);

```

Answer: 
Use something like:

```
$newArray = array();
$newArray = explode(" - ", $order);

foreach ($newArray as $arrayItem) 
{ 
  $parts = explode(',', $arrayItem);
  echo "<input type='text' value='$parts[0]'> - <input type='text' value='$parts[1]'><br/>";
}

```

If you're putting the values in text fields, then you should pull and use stock\_order ID's otherwise you won't be able to identify them.
Assuming that your seconds dimension is a string.

```
$array = Array(
    0 => "15896, 10",
    1 => "15897, 10"
    );

foreach ($array as &$v) {
    $result = preg_split("/[\s]*,[\s]*/", $v);

    foreach ($result as &$r) {
        echo "<input type='text' value='".$r."'/>";
    }
//    echo "<\br>";
}

```