Question: I am getting confused as to how I could loop trough my multidimensional associative array and pull the values separately to insert into my database. I am wanting to pull each item from the old array and populate it into a column called old and pull each item from the new array and populate it to the new column.

```
    $array = array(

        'old' => array('item1', 'item2'),
        'new' => array('item3', 'item4')

    );

    foreach($array as $items){

        foreach($items as $value){

        $model = new \Namespace\Model;
        $model->old = $items['old'];
        $model->new = $items['new']
        $model->save();

        }

    }

```

Answer: 
Well, I think `foreach` is not going to help you here. Try this:

```
$array = array(

        'old' => array('item1', 'item2'),
        'new' => array('item3', 'item4')

    );

if(count($array['old'] == $array['new'])) {
    $model = new \Namespace\Model;
    for($i = 0; $i < count($array['old']); $i++){
        $model->old = $array['old'][$i];
        $model->new = $array['new'][$i];
        $model->save();
    }

}

```
try this:

```
$array = array( array("item1" => "1" , "item2" => "2") , array("item1" =>"1", "item2" =>"2");

```

You would have to parse each different array all the sub arrays would just run in a for loop like this:

```
for($i = 0, $i < $array->getLength;$i++){
$array["item1"][$i];
}

```