3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getWork($id) { //read work ID from array //TODO } function convertCode($input=null,$dn=0) { //convert a country code to a country name or vice versa //if $dn, use display names (second element in subarray) //if no input, return array of $codes,$displaynames $i=1;$codes=null;while($i=1){$i++;$codes = array( //UNHIDE FOR COUNTRY CODE LIST "AF"=>array("Afghanistan","Afġānistān"), "AL"=>"Albania", "DZ"=>array("Algeria","Algéria"), "AD"=>"Andorra", "AO"=>"Angola", "AQ"=>array("Antarctica","Marie Byrd Land"), "AG"=>array("Antigua and Barbuda",array("Antigua","Barbuda")), "AR"=>array("Argentina","Argentina (excluding Antártida Argentina east of 20°W and Islas del Atlántico Sur)"), "AM"=>array("Armenia",array("Armenia (excluding Artsvashen and Kalbajar)","Yuxarı Əskipara","Barxudarlı","Yaradullu","Karki","Laçın","Qubadlı","Cəbrayıl","Zəngilan")), "AU"=>array("Australia","Christmas Island","Cocos Islands","Heard Island","McDonald Islands","Norfolk Island","Australian Antarctic Territory"), "AT"=>"Austria", "AZ"=>array("Azerbaijan",array("Azerbaijan (excluding Barxudarlı, Cəbrayıl, Dağlıq Qarabağ, Karki, Kəlbəcər, Laçın, Qubadlı, Yaradullu, Yuxarı Əskipara, Zəngilan)","Artsvashen")), "BS"=>"Bahamas", "BH"=>array("Bahrain","Baḥrayn"), "BD"=>array("Bangladesh",array("Bangladesh (excluding Daikhata-Dumabari)","Boraibari")), "BB"=>"Barbados", "BY"=>array("Belarus","Belaruś"), "BE"=>"Belgium", "BZ"=>"Belize", "BJ"=>array("Benin","Bénin"), "BM"=>"Bermuda", "BT"=>"Bhutan", "BO"=>"Bolivia", "BA"=>array("Bosnia and Herzegovina",array("Bosnia","Herzegovina")), "BW"=>"Botswana", "BR"=>"Brazil", "BN"=>array("Brunei","Brunei (excluding Spratly Islands)"), "BG"=>"Bulgaria", "BF"=>"Burkina Faso", "BI"=>"Burundi", "KH"=>"Cambodia", "CM"=>array("Cameroon",array("Cameroon","Bakassi")), "CA"=>array("Canada",array("Canada","Machias Seal Island","North Rock")), "CV"=>"Cape Verde", "CF"=>"Central African Republic", "TD"=>"Chad", "CL"=>array("Chile","Chile (excluding areas of Antártica Chilena south of 60°S and west of 80°W)"), "CN"=>array("China",array("China (portions under PRC control, excluding Anbo Shazhou, Àomén, Beizi Jiao, Chumar, Danwan Jiao, Feixin Dǎo, Guangxing Jiao, Guangxingzai Jiao, Hongxiu Dǎo, Huo'ai Jiao, Kaurik, Jadh, Lapthal, Manhuan Dǎo, Nanyue Dǎo, Shipki Pass, Siling Jiao, Xi Jiao, Xiānggǎng, Xīyuè Dǎo, Yangxin Shazhou, Zhōngyè Dǎo, areas of Zàngnán under Indian control)","Zamora","Đá Xu Bi","Đá Lạc","Đá Vành Khăn","Panganiban","Đá Tư Nghĩa","Đá Gạc Ma","Mabini","Burgos","Tàipíng Island","Demchok","Gando","Hoàng Sa Archipelago","Shaksgam Valley","Panatag Shoal")), "CO"=>array("Colombia",array("Colombia","Bajo Nuevo Bank")) "KM"=>array("Comoros","Comoros (excluding Glorioso Islands and Maore)"), "CG"=>array("Republic of the Congo","Congo, Republic of the"), "CD"=>array("Democratic Republic of the Congo","Congo, Democratic Republic of the"), "CK"=>"Cook Islands", "CR"=>"Costa Rica", "CI"=>array("Ivory Coast","Côte d'Ivoire"), "HR"=>array("Croatia","Croätia"), "CU"=>"Cuba", "CY"=>array("Cyprus","Cyprus (excluding Akrotiri, Dhekelia, areas under TRNC control)"), "CZ"=>"Czech Republic", "DK"=>array("Denmark",array("Denmark","Færøe Islands","Greenland")), "DJ"=>array("Djibouti","Djibouti (excluding Doumeira)"), "DM"=>"Dominica", "DO"=>"Dominican Republic", "EC"=>"Ecuador", "EG"=>array("Egypt",array("Egypt","Ḥalāyeb","Tiran Island","Sanafir Island")), "SV"=>array("El Salvador","El Salvador (excluding Conejo Island)"), "GQ"=>"Equatorial Guinea", "ER"=>array("Eritrea",array("Eritreā (excluding Badme and Bure)","Doumeira")), "EE"=>array("Estonia","Estonia (excluding Jaanilinn)"), "ET"=>array("Ethiopia",array("Ethiōṗiā","Badme","Bure","Ogaadeen")), "FJ"=>array("Fiji","Fījī"), "FI"=>array("Finland",array("Finland","Åland")), "FR"=>array("France",array("France","Adélie Land","Tromelin Island","Glorioso Islands","Bassas da India","Maore","Europa Island","Juan de Nova Island","Réunion","French Guiana","French Polynesia","French Southern and Antarctic Lands","Martinique","Guadeloupe","Mayotte","French Polynesia","New Caledonia","Saint Pierre","Saint Martin","Saint Barthelemy","Miquelon","Wallis","Futuna")), "GA"=>"Gabon", "GM"=>array("The Gambia","Gambia, The"), "GE"=>array("Georgia","Georgia (excluding Apkhazeti and Tsxinvalis)"), "DE"=>"Germany", "GH"=>"Ghana", "GR"=>"Greece", "GD"=>"Grenada", "GT"=>array("Guatemala","Guatemala (excluding areas under Belizean control)"), "GW"=>"Guinea-Bissau", "GY"=>array("Guyana",array("Guyana","Guayana Esequiba")), "HT"=>array("Haiti","Haïti (excluding Navassa Island)"), "VA"=>"Vatican City", "HN"=>array("Honduras",array("Honduras","Conejo Island")), "HK"=>"Hong Kong", "HU"=>"Hungary", "IS"=>"Iceland", "IN"=>array("India",array("India (excluding Boraibari, Demchok, Gilgit-Baltistan, Shaksgam Valley, areas of Kashmir under Pakistani control)","Kashmir (areas under Indian control)","Zàngnán (areas under Indian control)","Daikhata-Dumabari","Chumar","Kaurik","Shipki Pass","Jadh","Lapthal")), "ID"=>"Indonesia", "IR"=>array("Iran",array("Iran","Abu Musa","Greater Tunb","Lesser Tunb")), "IQ"=>array("Iraq","Irāq"), "IE"=>"Ireland", "IL"=>array("Israel",array("Isrā'el","Golan Heights","Jerusalem","Mazāri‘ Šib‘ā")), "IT"=>"Italy", "JM"=>array("Jamaica","Jamaica (excluding Bajo Nuevo Bank)"), "JP"=>array("Japan","Japan (excluding Etorofu-tō, Habomai Islands, Kunashiri-tō, Shikotan-tō, Takeshima)"), "JO"=>"Jordan", "KZ"=>"Kazakhstan", "KE"=>array("Kenya","Kenya (excluding Ilemi)"), "KI"=>"Kiribati", "KP"=>array("North Korea",array("Korea (areas under DPRK control, excluding Gando)","Rasŏn")), "KR"=>array("South Korea",array("Korea (areas under ROK control, excluding Gando)","Takeshima")), "KW"=>"Kuwait", "KG"=>"Kyrgyzstan", "LA"=>"Laos", "LV"=>"Latvia", "LB"=>array("Lebanon","Lebanon (excluding Mazāri‘ Šib‘ā)"), "LS"=>"Lesotho", "LR"=>"Liberia", "LY"=>array("Libya","Lībyā"), "LI"=>"Liechtenstein", "LT"=>"Lithuania", "LU"=>"Luxembourg", "MO"=>"Macau", "MK"=>array("Macedonia","Macedonia, Former Yugoslav Republic of"), "MG"=>array("Madagascar","Madagascar (excluding Bassas da India, Europa Island, Glorioso Islands, Juan de Nova Island)"), "MW"=>array("Malawi","Malaŵi"), "MY"=>array("Malaysia",array("Malaysia (excluding Terumbu Laksamana)","Celerio","Danwan Jiao","Đá Hoa Lau","Antonio Luna","Guangxingzai Jiao","Bãi Kiêu Ngựa","Rajah Matanda","Guangxing Jiao","Đá Suối Cát")), "MV"=>"Maldives", "ML"=>"Mali", "MT"=>"Malta", "MH"=>array("Marshall Islands","Marshall Islands (excluding Wake Island)"), "MR"=>array("Mauritania",array("Maūrītāniā","Lāgoūīrä")), "MU"=>array("Mauritius","Mauritius (excluding Chagos Archipelago and Tromelin Island)"), "MX"=>array("Mexico","México"), "FM"=>array("Micronesia","Micronesia, Federated States of"), "MD"=>array("Moldova","Moldova (excluding Stînga Nistrului)"), "MC"=>"Monaco", "MN"=>"Mongolia", "ME"=>"Montenegro", "MA"=>array("Morocco",array("Morocco (excluding Âġoūānīt, Bīr Leḥlū, Lāgoūīrä, Meḥaīres, Melīlla, Mīǧek, Sebta, Takfarinas, Tīfārītī, Zūg)","Sahrawi Arab Democratic Republic (areas outside Liberated Zone)")), "MZ"=>"Mozambique", "MM"=>array("Burma",array("Burma","Myănmar","Doi Lang")), "NA"=>"Namibia", "NR"=>array("Nauru","Naüru"), "NP"=>array("Nepal","Nepāl"), "NL"=>array("Netherlands",array("Netherlands","Caribbean Netherlands (BES)","Curaçao","Aruba","Sint Maarten")), "NZ"=>array("New Zealand",array("New Zealand","Ross Dependency","Tokelau (excluding Swains Island)"), "NI"=>array("Nicaragua","Nicaragua (excluding Bajo Nuevo Bank)"), "NE"=>"Niger", "NG"=>array("Nigeria","Nigeria (excluding Bakassi)"), "NU"=>array("Niue","Niuē"), "NO"=>array("Norway",array("Norway","Peter I Island","Bouvetøya","Svalbard","Jan Mayen","Queen Maud Land")), "OM"=>array("Oman","Omān"), "PK"=>array("Pakistan",array("Pākistān (excluding areas of Kashmir under Indian control)", "Kashmir (areas under Pakistani control)","Gilgit-Baltistan")), "PW"=>"Palau", "PS"=>array("Palestine","Palestine (excluding Jerusalem)"), "PA"=>"Panama", "PG"=>"Papua New Guinea", "PY"=>"Paraguay", "PE"=>array("Peru","Perú"), "PH"=>array("Philippines",array("Philippines (excluding Antonia Luna, Binago, Burgos, Celerio, Datu Kalantiaw, Kanlurang Quezon, Mabini, Ligaw, Panatag Shoal, Panganiban, Pugad, Rajah Matanda, Zamora)","Feixin Dǎo","Đảo Bình Nguyên","Bãi An Nhơn","Yangxin Shazhou","Đảo Loại Ta","Nanyue Dǎo","Đá Cá Nhám","Huo'ai Jiao","Đảo Vĩnh Viễn","Manhuan Dǎo","Đảo Song Tử Đông","Beizi Jiao","Đảo Thị Tứ","Zhōngyè Dǎo","Đảo Dừa","Xīyuè Dǎo","Đá Công Đo","Terumbu Laksamana","Siling Jiao")), "PL"=>"Poland", "PT"=>array("Portugal","Portugal (excluding Olivença)"), "QA"=>array("Qatar","Qaṭar"), "RO"=>array("Romania","România"), "RU"=>array("Russia",array("Russia","Crimea","Sevastopol","Jaanilinn","Etorofu-tō","Kunashiri-tō","Habomai Islands","Shikotan-tō")), "RW"=>array("Rwanda","Rẅanda"), "KN"=>array("Saint Kitts and Nevis",array("Saint Kitts","Nevis")), "VC"=>array("Saint Vincent and the Grenadines",array("Saint Vincent","Grenadines")), "WS"=>array("Samoa","Sāmoa"), "SM"=>"San Marino", "ST"=>array("Sao Tome and Principe",array("São Tomé","Príncipe")), "SA"=>array("Saudi Arabia","Saūdi Arabia (excluding Tiran and Sanafir Islands)"), "SN"=>array("Senegal","Sénégal"), "RS"=>array("Serbia",array("Serbia (excluding Kosovo and Metohija)","Ibarski Kolašin")), "SC"=>array("Seychelles","Seychelles (excluding Glorioso and Tromelin Islands)"), "SL"=>"Sierra Leone", "SG"=>"Singapore", "SK"=>"Slovakia", "SI"=>"Slovenia", "SB"=>"Solomon Islands", "SO"=>array("Somalia","Ṣomālia (excluding Ogaadeen and Somaliland)"), "ZA"=>array("South Africa",array("South Africa","KaNgwane")), "SS"=>array("South Sudan",array("South Sūdān (excluding Abyei, Heglig, Ilemi)","Kafia Kingi","Kaka")), "ES"=>array("Spain",array("Spain (excluding Gibraltar)","Olivença","Canary Islands","Ceuta","Sebta","Melīlla","Takfarinas")), "LK"=>array("Sri Lanka","Śrī Laṃkā"), "SD"=>array("Sudan",array("Sūdān (excluding Ḥalāyeb, Kafia Kingi, Kaka)","Abyei","Heglig")), "SR"=>"Suriname", "SZ"=>array("Swaziland","Swaziland (excluding KaNgwane)"), "SE"=>"Sweden", "CH"=>"Switzerland", "SY"=>array("Syria","Syriā (excluding Golan Heights and Mazāri‘ Šib‘ā)"), "TW"=>array("Taiwan",array("China (areas under ROC control, excluding Anbo Shazhou, Beizi Jiao, Danwan Jiao, Feixin Dǎo, Guangxing Jiao, Guangxingzai Jiao, Hongxiu Dǎo, Huo'ai Jiao, Manhuan Dǎo, Nanzi Jiao, Nanyue Dǎo, Rasŏn, Siling Jiao, Xi Jiao, Xīyuè Dǎo, Yangxin Shazhou, Zhōngyè Dǎo)","Ligaw","Đảo Ba Bình")), "TJ"=>"Tajikistan", "TZ"=>"Tanzania", "TH"=>array("Thailand","Thailand (excluding Doi Lang)"), "TL"=>"Timor-Leste", "TG"=>"Togo", "TO"=>"Tonga", "TT"=>array("Trinidad and Tobago",array("Trinidad","Tobago")), "TN"=>array("Tunisia","Tūnisia"), "TR"=>array("Turkey",array("Türkey","Cyprus (areas under TRNC control)")), "TM"=>array("Turkmenistan","Türkmenistan"), "TV"=>"Tuvalu", "UG"=>"Uganda", "UA"=>array("Ukraine","Ukraine (excluding Crimea and Sevastopol)"), "AE"=>array("United Arab Emirates","United Arab Emirates (excluding Abu Musa and Greater and Lesser Tunbs)"), "GB"=>array("United Kingdom",array("United Kingdom","Islas del Atlántico Sur","Chagos Archipelago","British Indian Ocean Territory","Cayman Islands","British Virgin Islands","Akrotiri","Dhekelia","Malvinas","Falkland Islands","Montserrat","Gibraltar","Pitcairn","Isle of Man","Anguilla","Bermuda","British Antarctic Territory","Saint Helena","Ascension","Tristan da Cunha","South Georgia","South Sandwich Islands","Turks Islands","Caicos Islands","Jersey","Guernsey")), "US"=>array("United States",array("Wake Island","United States (excluding Bajo Nuevo Bank, Machias Seal Island, North Rock)","Swains Island","American Sāmoa","United States Virgin Islands","Guam","Northern Mariana Islands","Puerto Rico","Baker Island","Howland Island","Jarvis Island","Johnston Atoll","Kingman Reef","Midway Islands","Palmyra Atoll","Wake Island","Navassa Island")), "UY"=>"Uruguay", "UZ"=>"Uzbekistan", "VU"=>array("Vanuatu","Vanuätu"), "VE"=>array("Venezuela","Venezuela (excluding Guayana Esequiba)"), "VN"=>array("Vietnam",array("Việtnam (excluding Bãi An Nhơn, Bãi Kiêu Ngựa, Đá Cá Nhám, Đá Công Đo, Đá Gạc Ma, Đá Hoa Lau, Đá Lạc, Đá Tư Nghĩa, Đá Vành Khăn, Đá Xu Bi, Đảo Ba Bình, Đảo Bình Nguyên, Đảo Dừa, Đảo Loại Ta, Đảo Song Tử Đông, Đá Suối Cát, Đảo Thị Tứ, Đảo Vĩnh Viễn, Hoàng Sa Archipelago)","Datu Kalantiaw","Pulau Amboya Kecil","Anbo Shazhou","Binago","Hongxiu Dao","Pugad","Nanzi Jiao","Kanlurang Quezon","Xi Jiao")), "EH"=>array("Sahrawi Arab Democratic Republic",array("Ṣaḥrāwī Arab Democratic Republic (excluding areas outside Liberated Zone)","Âġoūānīt","Bīr Leḥlū","Lāgoūīrä","Meḥaīres","Mīǧek","Tīfārītī","Zūg")), "YE"=>"Yemen", "ZM"=>"Zambia", "ZW"=>"Zimbabwe", "XO"=>array("South Ossetia",array("South Ossetia","Tsxinvalis")), "XA"=>array("Abkhazia",array("Abkhazia","Apkhazeti")) "XT"=>array("Transnistria",array("Stînga Nistrului","Pridnestrovie","Trnadniestria")), "XN"=>array("Nagorno-Karabakh",array("Dağlıq Qarabağ","Kalbajar","Nagorno-Karabakh","Artsakh Republic","Lernayin Gharabaghi","Kəlbəcər")), "XS"=>"Somaliland" );} if($input===null) return $codes; if(strlen($input)==2){ if(is_array($codes[$input])){ if($dn) return $codes[$input][0]; else return $codes[$input][1]; } else return $codes[$input]; } else { $a=array_search($input,$codes,1); if($a!==FALSE) return $a; else{ foreach($codes as $b=>$a){ if(is_array($a)) { if($a[0]===$input) return $b; }}}} return FALSE; } function treatyDates($id) { //return dates of ratification of copyright treaties in country with country code $id //Berne, UCC, TRIPS, WCT, array of bilateral country codes //TODO } var_dump(convertCode()); ?>
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected '"KM"' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /in/Z7T2T on line 50
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.28
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /in/Z7T2T on line 50
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /in/Z7T2T on line 50
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/Z7T2T on line 50
Process exited with code 255.