Remove comma from string in php
<p>suppose the value is </p>

<p><code>1,2,,4,5,6</code> - For this i can use <code>str_replace(",,",",",$mystring)</code> to get <code>1,2,4,5,6</code></p>

<p>How to get values like <code>2,4,5,6</code> from <code>,2,,4,5,6</code> where two or more consecutive commas are replaced by a single comma and if comma comes before any value it is neglected.If there is only commas like <code>,,,,,,</code> then empty value is returned.</p>

<p>how to do this in php.</p>