Parsing the Twitter Trends API

Use the following PHP code to determine all the locations (cities and countries) for which Twitter can offer local trends data

The Twitter API offers the Trends availability data in JSON format that you can parse with the json_decode function of PHP.


 function compare_country($a, $b) {
   return strnatcmp($a['country'], $b['country']);