PHP Array Of Canadian States

23rd April 2009

Use the following array to print out a list of Canadian states, also know as provinces.

  1. $canadian_states = array(
  2. "BC" => "British Columbia",
  3. "ON" => "Ontario",
  4. "NL" => "Newfoundland and Labrador",
  5. "NS" => "Nova Scotia",
  6. "PE" => "Prince Edward Island",
  7. "NB" => "New Brunswick",
  8. "QC" => "Quebec",
  9. "MB" => "Manitoba",
  10. "SK" => "Saskatchewan",
  11. "AB" => "Alberta",
  12. "NT" => "Northwest Territories",
  13. "NU" => "Nunavut",
  14. "YT" => "Yukon Territory"
  15. );

Here is the same array, but with the French versions of the states.

  1. $canadian_states = array(
  2. "AB" => "Alberta",
  3. "BC" => "Colombie-Britannique",
  4. "MB" => "Manitoba",
  5. "NB" => "Nouveau-Brunswick",
  6. "NL" => "Terre-Neuve-et-Labrador",
  7. "NS" => "Nouvelle-Écosse",
  8. "NT" => "Territoires du Nord-Ouest",
  9. "NU" => "Nunavut",
  10. "ON" => "Ontario",
  11. "PE" => "Île-du-Prince-Édouard",
  12. "QC" => "Québec",
  13. "SK" => "Saskatchewan",
  14. "YT" => "Yukon"
  15. );

Comments

Permalink
Some corrections for your Canadian provinces and territories array: Newfoundland should be "NL" => "Newfoundland and Labrador" and you're missing: "NU" => "Nunavut" Canadian subnational postal abbreviations

Submitted by Eric on Tue, 05/05/2009 - 15:21

Permalink
Thanks for the info and the link. I have updated the post.

Submitted by philipnorton42 on Tue, 05/05/2009 - 15:25

Permalink
Thanks man!

Submitted by kido on Wed, 10/30/2013 - 13:15

Permalink
You forgot to add commas at the end of each line ... but thanks anyway!

Submitted by jell0wed on Tue, 07/01/2014 - 20:57

Permalink
Oops, sorry about that. Sorted now! :)

Submitted by philipnorton42 on Wed, 07/02/2014 - 18:45

Permalink
One more comma needed! Line 13 after "Nunavut"

Submitted by Craig on Mon, 12/22/2014 - 04:28

Permalink
Oops. Thanks! corrected now :)

Submitted by philipnorton42 on Tue, 12/23/2014 - 14:13

Add new comment

The content of this field is kept private and will not be shown publicly.