Using a variable inside a print
You can just change the 1 to your particular variable in the loop.

Example:

foreach ($values as $k =&gt; $v) {
  print $node-&gt;field_carousel_ . $v . [0]['filepath'];
}


That should output the values you need.