Best way of getting a a series of custom fields into an array?
<p>I've a series of custom fields attached to certain pages. These fields are named slide1, slide2, side3, slide4, slide5, slide6. </p>

<p>These are images which are going to be used as a slideshow (I'm using jflow slider for this - <a href="http://net.tutsplus.com/articles/news/using-the-wonderful-jflow-plugin-screencast/" rel="nofollow">http://net.tutsplus.com/articles/news/using-the-wonderful-jflow-plugin-screencast/</a> )</p>

<p>(I don't want to call them all 'slide' and put them in an custom field array because there may be captions for each slide, and when both slides and captions are custom field arrays, the order may not match up)</p>

<p>Now, sometimes there will be only 3 slides entered (slide1 to slide3), and sometimes all 6 slides (slide1 to slide6).</p>

<p>Not being very PHP savvy, I wonder what the best way best way to stick these custom fields into a PHP array, and then iterate thru them to print out the code, which looks a bit like the below?</p>

<pre><code>&lt;div id="slides"&gt;  
 &lt;div&gt;&lt;img src="qwerty.jpg"&gt;  
&lt;/div&gt;  
 &lt;div&gt;&lt;img src="foo.jpg"&gt;  
 &lt;/div&gt; 
 &lt;div&gt;&lt;img src="test.jpg"&gt;   
 &lt;/div&gt;
&lt;/div&gt;  
</code></pre>

<p>The code to print, for instance slide1's image, would be something like:</p>

<pre><code>&lt;img src="&lt;?php echo wp_get_attachment_url($slide1); ?&gt;"&gt;
</code></pre>
