title: php preg_match validate price format
body: <p>I'd like to validate a numeric field (price) in my form.<br>
  I try in this way to validate format like <code>10.00</code> and it's ok.</p>
  
  <pre><code>$pattern = '/^\d+(:?[.]\d{2})$/';
  
  if (preg_match($pattern, $_POST['price']) == '0') {
     echo "ERROR";
     exit;
  }
  </code></pre>
  
  <p>Now I'd like to validate, <strong>at the same time</strong>, the field format like <code>10.00</code> and <code>10</code>.
  How could I do this?  </p>