Counting and grouping items by relative position. grouping by 5's for instance
<p>The idea is that there will be a php function that echo's html for every image in a directory(scandir)</p>

<p>I figure using a for each(something like) to walk through that array and assigns the values to img src values </p>

<p>but in order for there to be a function that assigns class values that would allow for </p>

<p>scripted rather than manual css positioning I need to be able to assign classes based on </p>

<p>relative position in a grouping of objects. for instance, there are 50 images in a directory the scandir returns an array of those files a function generates img tags for each item assigns class (a function in a variable to accomplish this, i suspect) by cycling through 5 classes  with the output being like</p>

<pre><code>&lt;img class="a" src="example"&gt;
&lt;img class="b" src="example"&gt;
&lt;img class="c" src="example"&gt;
&lt;img class="d" src="example"&gt;
&lt;img class="e" src="example"&gt;

&lt;img class="a" src="example"&gt;
&lt;img class="b" src="example"&gt;
&lt;img class="c" src="example"&gt;
&lt;img class="d" src="example"&gt;
&lt;img class="e" src="example"&gt;


&lt;img class="a" src="example"&gt;
&lt;img class="b" src="example"&gt;
&lt;img class="c" src="example"&gt;
&lt;img class="d" src="example"&gt;
&lt;img class="e" src="example"&gt;


&lt;img class="a" src="example"&gt;
&lt;img class="b" src="example"&gt;
&lt;img class="c" src="example"&gt;
&lt;img class="d" src="example"&gt;
&lt;img class="e" src="example"&gt;


&lt;img class="a" src="example"&gt;
&lt;img class="b" src="example"&gt;
&lt;img class="c" src="example"&gt;
&lt;img class="d" src="example"&gt;
&lt;img class="e" src="example"&gt;


&lt;img class="a" src="example"&gt;
&lt;img class="b" src="example"&gt;
&lt;img class="c" src="example"&gt;
&lt;img class="d" src="example"&gt;
&lt;img class="e" src="example"&gt;
</code></pre>

<p>now the numbers 50 &amp; 5 are hypothetical, I will more likely using class assignment cycles of 7 or 12</p>

<p>really please how do I do this? I'm just learning on my own and it's really important.</p>
