Title: Undefined variable: country_codes
Last modified: February 25, 2018

---

# Undefined variable: country_codes

 *  Resolved [Paweł](https://wordpress.org/support/users/mrpauloen/)
 * (@mrpauloen)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-country_codes/)
 * Hi guys.
 * There is something wrong with `get_countrycodes()` function in `tools.php` file,
   because I get constantly this PHP error:
 *     ```
       [25-Feb-2018 10:14:13 UTC] PHP Notice:  Undefined variable: country_codes in 
       ../wp-content/plugins/google-analytics-dashboard-for-wp/tools/tools.php on line 20
       ```
   
 * I figured that:
 *     ```
       		public static function get_countrycodes() {
       			include_once 'iso3166.php';
       			return $country_codes;
       		}
       ```
   
 * `include_once` doesn’t include (or doesn’t assing values to variable?) that file
   and that’s why `$country_codes` is not defined.
 * But, when I changed it to `include` (or `require`) it seems to be ok and no error
   are returned.
 * Cheers
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fundefined-variable-country_codes%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

The topic ‘Undefined variable: country_codes’ is closed to new replies.

 * ![](https://ps.w.org/google-analytics-dashboard-for-wp/assets/icon.svg?rev=2243225)
 * [ExactMetrics - Google Analytics Dashboard for WordPress (Website Stats Plugin)](https://wordpress.org/plugins/google-analytics-dashboard-for-wp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/google-analytics-dashboard-for-wp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/google-analytics-dashboard-for-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/google-analytics-dashboard-for-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-analytics-dashboard-for-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-analytics-dashboard-for-wp/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [Paweł](https://wordpress.org/support/users/mrpauloen/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/undefined-variable-country_codes/)
 * Status: resolved