Duplicate words in PHP : <p>I have probably information about whether it is available in PHP to detect a duplicate and a book about not removing it and adding it to -1, -2, -3</p>

<p>Example:</p>

<pre><code>$string = 'H4,H4,H3,WY21W,W5W,W5W,WY21W,W21/5W,W21/5W,W21W,W16W,W5W';
</code></pre>

<p>Result:</p>

<pre><code>$output = 'H4,H4-1,H3,WY21W,W5W,W5W-1,WY21W-1,W21/5W,W21/5W-1,W21W,W16W,W5W-2'
</code></pre>
