title: How to validate US phone numbers, US state code and US zip code in PHP?
body: <p>I want to validate US phone number, US state code and US zip code using PHP for it I wrote following functions but they are not working properly.</p>
  
  <pre><code>/** check phone number validation**/
    function phone_no($str) { 
      return (bool)eregi( "^([-\(\)\+, 0-9])+$", $str );
    }
  /** check zip code validation**/
  function integer($str) {
      return (bool) preg_match('/^[\-+]?[0-9]+$/', $str);
    }
  /** check state code validation **/
  
      function alpha_num_symbol($str) {
          return ( ! preg_match("/^([a-z0-9\+_\.*-\/'&amp; ])+$/i", $str)) ? FALSE : TRUE;
      }
  </code></pre>
  
  <p>I'm passing the value from input field of form using variable <code>$str</code>. Can someone please help me in correcting my code so that I can properly validate US phone number, US zip code and US state code. If anyone have any idea to make this thing workable please help me. Thanks in advance. </p>