Skip to content

Instantly share code, notes, and snippets.

@serverdensity
serverdensity / array.php
Created Dec 20, 2009
Country dialing code select drop menu
View array.php
<?php
// Country code
$countries = array();
$countries[1] = 'Canada (+1)'; // 1 so array doesn't start at 0 and show empty
$countries[] = 'China (+86)';
$countries[] = 'France (+33)';
$countries[] = 'Germany (+49)';
$countries[] = 'India (+91)';
$countries[] = 'Japan (+81)';
$countries[] = 'Pakistan (+92)';
@serverdensity
serverdensity / List of timezones as an HTML drop menu
Created May 8, 2009
List of timezones as an HTML drop menu
View List of timezones as an HTML drop menu
<label for="timezone">Timezone</label>
<select name="timezone" id="timezone">
<optgroup label="Africa">
<option value="Africa/Abidjan" label="Abidjan">Abidjan</option>
<option value="Africa/Accra" label="Accra">Accra</option>
<option value="Africa/Addis_Ababa" label="Addis Ababa">Addis Ababa</option>
<option value="Africa/Algiers" label="Algiers">Algiers</option>
<option value="Africa/Asmara" label="Asmara">Asmara</option>
<option value="Africa/Asmera" label="Asmera">Asmera</option>
<option value="Africa/Bamako" label="Bamako">Bamako</option>
@serverdensity
serverdensity / Generate a list of timezones with PHP
Created Mar 20, 2009
Generate a list of timezones with PHP
View Generate a list of timezones with PHP
http://www.php.net/manual/en/function.timezone-identifiers-list.php
<?php
$zones = timezone_identifiers_list();
foreach ($zones as $zone)
{
$zoneExploded = explode('/', $zone); // 0 => Continent, 1 => City
// Only use "friendly" continent names