title: PHP - Check if there is a word before AND behind a comma?
body: <p>I want a user to enter his city and country seperated with a comma to store the data in my database.</p>
  
  <p>Now my current code is:</p>
  
  <pre><code>if (empty($_POST['location']) || substr_count($_POST['location'], ',') != 1) 
  </code></pre>
  
  <p>but this only checks if ONE comma is given. I want to check if there is ONE comma AND one word before AND behind the comma. 
  Also these words should at least have 2 chars, because I guess there isn't a country or city with one char(?).</p>
  
  <p>Edit: I just found out there are cities with just one character. So please forget my last sentence.</p>