Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder
    Join Date
    Jul 2011
    Posts
    272
    Thanks
    63
    Thanked 1 Time in 1 Post

    Preserve parentheses in Array?

    How would i preserve the parenthesis in the following code?

    PHP Code:
    $strings = array('afghanistan','albania','algeria','american samoa','andorra','angola','anguilla','antarctica','antigua and barbuda','argentina','armenia','aruba','australia','austria','azerbaijan','bahamas','bahrain','bangladesh','barbados','belarus','belgium','belize','benin','bermuda','bhutan','bolivia','bosnia and herzegowina','botswana','bouvet island','brazil','british indian ocean territory','brunei darussalam','bulgaria','burkina faso','burundi','cambodia','cameroon','canada','cape verde','cayman islands','central african republic','chad','chile','china','christmas island','cocos (keeling) islands','colombia','comoros','congo','congo, the drc','cook islands','costa rica','cote d\'ivoire','croatia (local name: hrvatska)','cuba','cyprus','czech republic','denmark','djibouti','dominica','dominican republic','east timor','ecuador','egypt','el salvador','equatorial guinea','eritrea','estonia','ethiopia','falkland islands (malvinas)','faroe islands','fiji','finland','france','france, metropolitan','french guiana','french polynesia','french southern territories','gabon','gambia','georgia','germany','ghana','gibraltar','greece','greenland','grenada','guadeloupe','guam','guatemala','guinea','guinea-bissau','guyana','haiti','heard and mc donald islands','holy see (vatican city state)','honduras','hong kong','hungary','iceland','india','indonesia','iran (islamic republic of)','iraq','ireland','israel','italy','jamaica','japan','jordan','kazakhstan','kenya','kiribati','korea, d.p.r.o.','korea, republic of','kuwait','kyrgyzstan','laos ','latvia','lebanon','lesotho','liberia','libyan arab jamahiriya','liechtenstein','lithuania','luxembourg','macau','macedonia','madagascar','malawi','malaysia','maldives','mali','malta','marshall islands','martinique','mauritania','mauritius','mayotte','mexico','micronesia, federated states of','moldova, republic of','monaco','mongolia','montserrat','morocco','mozambique','myanmar (burma) ','namibia','nauru','nepal','netherlands','netherlands antilles','new caledonia','new zealand','nicaragua','niger','nigeria','niue','norfolk island','northern mariana islands','norway','oman','pakistan','palau','panama','papua new guinea','paraguay','peru','philippines','pitcairn','poland','portugal','puerto rico','qatar','reunion','romania','russian federation','rwanda','saint kitts and nevis','saint lucia','saint vincent and the grenadines','samoa','san marino','sao tome and principe','saudi arabia','senegal','seychelles','sierra leone','singapore','slovakia (slovak republic)','slovenia','solomon islands','somalia','south africa','south georgia and south s.s.','spain','sri lanka','st. helena','st. pierre and miquelon','sudan','suriname','svalbard and jan mayen islands','swaziland','sweden','switzerland','syrian arab republic','taiwan, province of china','tajikistan','tanzania, united republic of','thailand','togo','tokelau','tonga','trinidad and tobago','tunisia','turkey','turkmenistan','turks and caicos islands','tuvalu','uganda','ukraine','united arab emirates','united kingdom','united states','u.s. minor islands','uruguay','uzbekistan','vanuatu','venezuela','viet nam','virgin islands (british)','virgin islands (u.s.)','wallis and futuna islands','western sahara','yemen','zambia','zimbabwe'); 
    // Order is important 
    $replacements = array('AF','AL','DZ','AS','AD','AO','AI','AQ','AG','AR','AM','AW','AU','AT','AZ','BS','BH','BD','BB','BY','BE','BZ','BJ','BM','BT','BO','BA','BW','BV','BR','IO','BN','BG','BF','BI','KH','CM','CA','CV','KY','CF','TD','CL','CN','CX','CC','CO','KM','CG','CD','CK','CR','CI','HR','CU','CY','CZ','DK','DJ','DM','DO','TP','EC','EG','SV','GQ','ER','EE','ET','FK','FO','FJ','FI','FR','FX','GF','PF','TF','GA','GM','GE','DE','GH','GI','GR','GL','GD','GP','GU','GT','GN','GW','GY','HT','HM','VA','HN','HK','HU','IS','IN','ID','IR','IQ','IE','IL','IT','JM','JP','JO','KZ','KE','KI','KP','KR','KW','KG','LA','LV','LB','LS','LR','LY','LI','LT','LU','MO','MK','MG','MW','MY','MV','ML','MT','MH','MQ','MR','MU','YT','MX','FM','MD','MC','MN','MS','MA','MZ','MM','NA','NR','NP','NL','AN','NC','NZ','NI','NE','NG','NU','NF','MP','NO','OM','PK','PW','PA','PG','PY','PE','PH','PN','PL','PT','PR','QA','RE','RO','RU','RW','KN','LC','VC','WS','SM','ST','SA','SN','SC','SL','SG','SK','SI','SB','SO','ZA','GS','ES','LK','SH','PM','SD','SR','SJ','SZ','SE','CH','SY','TW','TJ','TZ','TH','TG','TK','TO','TT','TN','TR','TM','TC','TV','UG','UA','AE','GB','US','UM','UY','UZ','VU','VE','VN','VG','VI','WF','EH','YE','ZM','ZW'); 
    edit: found my error. one of my strings had a ' in it, and it threw it off.
    Last edited by markman641; 02-20-2012 at 01:46 AM.


 

LinkBacks (?)

  1. 04-23-2014, 05:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •