title: remove value from string
body: <p>If I have a string with IDs</p>
  
  <pre><code>$myIDs = '22,34,445,67889,23';
  </code></pre>
  
  <p>and I am given a value, how do I remove it from the string, assuming I know for sure it is in the string?</p>
  
  <pre><code>$removeID = '445';
  </code></pre>
  
  <p>Do I user preg_replace or is there a better method? For example, if it is in the middle of the string and I remove just a value, I'll end up with two commas and then I need to replace those with a single comma? </p>
  
  <pre><code>preg_replace($removeID, '', $myIDs);
  </code></pre>
  
  <p>UPDATE: These are all great suggestions. However, I just thought about one potential issue. This probably need to be handled as an array instead of regex. What is my string looks like this</p>
  
  <pre><code>$myIDs = '2312,23,234234';
  </code></pre>
  
  <p>and ID to remove</p>
  
  <pre><code>$removeID = '23';
  </code></pre>
  
  <p>There's too many potential matches...</p>