i am so stuck , please someone help if you have 2 min. 

i have a foreach where I get values from session something like 

```
foreach ($result as $i => $item ) {

         $values_array  = explode("\n",$get_widths); // outputs Array ( [0] => 120 [1] => 180) 
         // here I need to echo the value from the array but only ONCE
}

```

the issue is that this is used by 2 or more items and array outputs gets repeated every time , so if 2 items i get 
Array ( [0] => 120 [1] => 180) Array ( [0] => 120 [1] => 180) or 
120 120 
instead 

120 180 

for actual code see here 

```
<?php
foreach ($list as $i => &$item){
    $i=0;
    $is_group                   = $item_params->get('is_group');    
    $group_widths               = $item_params->get('group_widths');    
    $group_widths_array         = explode("\n",$group_widths);

    if($is_group == 1){

        echo $group_widths_array[$i];
    }

}
?>

```

please note I cant move outside the foreach. thank you