title: How can i convert a phone number to american format phone number in php?
body: <p>I have a phone number shuffled with hyphens.I want convert this phone number to american format by removing unwanted hyphens and adding necessary hyphens using php.
  For example</p>
  
  <pre><code>$phone=123--45-6-4523;
  </code></pre>
  
  <p>I want to cahnge the above to</p>
  
  <pre><code>$phone=123-456-4523;
  </code></pre>