title: PHP remove commas from numeric strings
body: <p>In PHP, I have an array of variables that are ALL strings.  Some of the values stored are numeric strings with commas.  </p>
  
  <p>What I need:</p>
  
  <p>A way to trim the commas from strings, and ONLY do this for numeric strings.  This isn't as straightforward as it looks.  The main reason is that the following fails:</p>
  
  <pre><code>$a = "1,435";
  
  if(is_numeric($a))
      $a = str_replace(',', '', $a);
  </code></pre>
  
  <p>This fails because <code>$a = "1435"</code> is numeric.  But <code>$a = "1,435"</code> is not numeric.  Because some of the strings I get will be regular sentences with commas, I can't run a string replace on every string. </p>