Title: condense PHP if statement
Last modified: August 19, 2016

---

# condense PHP if statement

 *  [bremmerm](https://wordpress.org/support/users/bremmerm/)
 * (@bremmerm)
 * [15 years ago](https://wordpress.org/support/topic/condense-php-if-statement/)
 * Is there a way to make this shorter?:
 * `if($shipping_country == "BG" || $shipping_country == "EE" || $shipping_country
   == "FI" || $shipping_country == "HU" || $shipping_country == "IE" || $shipping_country
   == "LV" || $shipping_country == "LT" || $shipping_country == "PL" || $shipping_country
   == "PT" || $shipping_country == "RO" || $shipping_country == "SI" || $shipping_country
   == "SK" || $shipping_country == "CZ")`

Viewing 1 replies (of 1 total)

 *  [Rahul Sonar](https://wordpress.org/support/users/rahulsonar/)
 * (@rahulsonar)
 * [15 years ago](https://wordpress.org/support/topic/condense-php-if-statement/#post-1974654)
 * This is not a question related to wordpress..
 * still, answer to your question:
 *     ```
       $ar = array("BG", "EE", "FI", .....);
       if(in_array($shipping_country, $ar)) {
       // do something..
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘condense PHP if statement’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Rahul Sonar](https://wordpress.org/support/users/rahulsonar/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/condense-php-if-statement/#post-1974654)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
