PHP: Pluck out variables inside echo

I have an array of Wordpress attachment IDs. I want to use wp_get_attachment_metadata() to get a few pieces of data for a slider.

The code below would make the most sense to me, but I’m breaking the site with it.

What’s the right way to pull out data from the array and echo it out?

$gallery_array is an array of image IDs
wp_get_attachment_metadata gets an array containing all of the images meta.

The part that’s causing problems is the

echo "... data-rsw=\"$img_meta['sizes']['medium']['width']\" ..."

part. I’m assuming there’s something wrong with my syntax, but I don’t know what.

foreach ($gallery_array as $gallery_img){
    	$img_meta = wp_get_attachment_metadata($gallery_img);
		echo "
   			<a class=\"rsImg\" data-rsw=\"$img_meta['sizes']['medium']['width']\"   data-rsBigImg=\"\" href=\"\">Vincent van Gogh - Still Life: Vase with Twelve Sunflowers<img width=\"96\" height=\"72\" class=\"rsTmb\" src=\"\" /></a>

I prefer using PHP HereDoc Strings because they eliminate a lot of syntax and make the string far more readable:

	$tmp = <<< ____EOT
   				class 	      = 'rsImg'
   				data-rsw 	  = '{$img_meta['sizes']['medium']['width']}'   
   				data-rsBigImg = '' 
   				href  	 	  = ''
   				Vincent van Gogh - Still Life: Vase with Twelve Sunflowers
   					width = '96' height='72' 
   					class = 'rsTmb' 
   					src   = '' 
echo '<pre>'; print_r($tmp); echo '</pre>';