PHP string loop and join
<p>Given a string such as "BARNYARD,FARMER,FOX,HEN,TRACTOR" (note string is in alphabetical order)</p>

<p>How would one loop through that string and create an array str[] below? Note the array-key is also in alphabetical order, this would help eliminate duplicate two or X-num word joins I believe?</p>

<pre><code>str[BARNYARD] = BARNYARD  
str[FARMER] = FARMER  
str[FOX] = FOX  
str[HEN] = HEN  
str[TRACTOR] = TRACTOR  
str[BARNYARDFARMER] = BARNYARD FARMER  
str[BARNYARDFOX] = BARNYARD FOX  
str[BARNYARDHEN] = BARNYARD HEN  
str[BARNYARDTRACTOR] = BARNYARD TRACTOR   
str[FARMERFOX] = FARMER FOX  
str[FARMERHEN] = FARMER HEN  
str[FARMERTRACTOR] = FARMER TRACTOR  
str[FOXHEN] = FOX HEN  
str[FOXTRACTOR] = FOX TRACTOR  
str[HENTRACTOR] = HEN TRACTOR  
str[BARNYARDFARMERFOX] = BARNYARD FARMER FOX  
str[BARNYARDFOXHEN] = BARNYARD FOX HEN  
str[BARNYARDHENTRACTOR] = BARNYARD HEN TRACTOR  
str[FARMERFOXHEN] = FARMER FOX HEN  
str[FARMERHENTRACTOR] = FARMER HEN TRACTOR  
str[FOXHENTRACTOR] = FOX HEN TRACTOR  
str[BARNYARDFARMERFOXHEN] = BARNYARD FARMER FOX HEN  
str[BARNYARDFOXHENTRACTOR] = BARNYARD FOX HEN TRACTOR  
str[FARMERFOXHENTRACTOR] = FARMER FOX HEN TRACTOR  
str[BARNYARDFARMERFOXHENTRACTOR] = BARNYARD FARMER FOX HEN TRACTOR
</code></pre>
