3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $regions = array( 'Africa' => DateTimeZone::AFRICA, 'America' => DateTimeZone::AMERICA, 'Antarctica' => DateTimeZone::ANTARCTICA, 'Aisa' => DateTimeZone::ASIA, 'Atlantic' => DateTimeZone::ATLANTIC, 'Europe' => DateTimeZone::EUROPE, 'Indian' => DateTimeZone::INDIAN, 'Pacific' => DateTimeZone::PACIFIC); $timezones = array();foreach ($regions as $name => $mask){ $zones = DateTimeZone::listIdentifiers($mask); foreach($zones as $timezone) { // Lets sample the time there right now $time = new DateTime(NULL, new DateTimeZone($timezone));  // Us dumb Americans can't handle millitary time $ampm = $time->format('H') > 12 ? ' ('. $time->format('g:i a'). ')' : '';  // Remove region name and add a sample time $timezones[$name][$timezone] = substr($timezone, strlen($name) + 1) . ' - ' . $time->format('H:i') . $ampm; }}  // View  print '<label>Select Your Timezone</label><select id="timezone">';foreach($timezones as $region => $list){ print '<optgroup label="' . $region . '">' . "\n"; foreach($list as $timezone => $name) { print '<option name="' . $timezone . '">' . $name . '</option>' . "\n"; } print '<optgroup>' . "\n";}print '</select>';
Output for 5.4.0 - 5.4.32
Parse error: syntax error, unexpected '$timezones' (T_VARIABLE) in /in/FUeZf on line 3
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/FUeZf on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_VARIABLE in /in/FUeZf on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ',', expecting '(' in /in/FUeZf on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ',', expecting '(' in /in/FUeZf on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/FUeZf on line 3
Process exited with code 255.