title: Extract City and State from a Full Address String following Specific Format
body: <p>I have a set of addresses stored as individual strings. Here are possible values of those strings:</p>
  
  <pre><code>"Staples Center, 555 Test Drive, Los Angeles, CA 98112"
  "555 Test Drive, Los Angeles, CA 98112"
  "Los Angeles, CA"
  "Los Angeles, CA 98112"
  "Los Angeles"
  </code></pre>
  
  <p>The dates will always follow this format, where it could contain a venue name, street address, city, state, and zip</p>
  
  <p>I would like to dynamically extract the city and state only from these strings:</p>
  
  <pre><code>$addresses_array = array(
      "Staples Center, 555 Test Drive, Los Angeles, CA 98112",
      "555 Test Drive, Los Angeles, CA 98112",
      "Los Angeles, CA",
      "Los Angeles, CA 98112",
      "Los Angeles"
  );
  
  foreach ($addresses_array as $address) {
      if (strpos($address, ',') !== false) {
          // extract the city and state
      }
  }
  </code></pre>
  
  <p>Given the pattern of the address values, is there something I can do to extract the city and state based on the commas?</p>
  
  <p>What I can see is that the city will always be the last comma in the string..</p>