-5

i want to input the country code like "fr" and get the largest city "paris" , and if possible also the continent, in PHP !

EvilThinker
  • 740
  • 1
  • 9
  • 13

1 Answers1

0

Extend to your needs, I already added the city you asked for:

$largest = [
    'fr' => 'paris',
];

$code = 'fr';

echo $largest[$code];

You can further improve this by wrapping it into a class supporting ArrayAccess giving a default value in case it does not exist.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • Epic fail... m8 what is the reason for this :D – DaGhostman Dimitrov Jul 04 '13 at 17:08
  • thanks but what i'm looking for exactly is a database with largest cities ! – EvilThinker Jul 04 '13 at 17:25
  • @EvilThinker: And you weren't able to google for those? Poor boy, try harder I'd say. Why don't you just take http://en.wikipedia.org/wiki/List_of_largest_cities_and_second_largest_cities_by_country ? – hakre Jul 04 '13 at 22:36
  • @hakre because it's working trust me , but i got a solution i will post it ! – EvilThinker Jul 04 '13 at 23:00
  • i needed to the get the largest city of a particular country to use in a timezone identifier in Carbon library , but i got a pretty useful function print_r(DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country_code)); – EvilThinker Jul 04 '13 at 23:14