<?php
// your code goes here
$addr1 = "5285 KEYES DR KALAMAZOO MI 49004 2613";
$addr2 = "PO BOX 35 COLFAX LA 71417 35";
$addr3 = "64938 MAGNOLIA LN APT B PINEVILLE LA 71360-9781";
function extract_zipcode($address) {
$zipcode = preg_match("/\b[A-Z]{2}\s+\d{5}(-\d{4})?\b/", $address, $matches); return $matches[0];
}
echo extract_zipcode($addr1) . ' ';
echo extract_zipcode($addr2) . ' ';
echo extract_zipcode($addr3) . ' ';
PD9waHAKCi8vIHlvdXIgY29kZSBnb2VzIGhlcmUKCgoKJGFkZHIxID0gIjUyODUgS0VZRVMgRFIgIEtBTEFNQVpPTyBNSSA0OTAwNCAyNjEzIjsKJGFkZHIyID0gIlBPIEJPWCAzNSAgQ09MRkFYIExBIDcxNDE3IDM1IjsKJGFkZHIzID0gIjY0OTM4IE1BR05PTElBIExOIEFQVCBCIFBJTkVWSUxMRSBMQSA3MTM2MC05NzgxIjsKCmZ1bmN0aW9uIGV4dHJhY3RfemlwY29kZSgkYWRkcmVzcykgewogICAgJHppcGNvZGUgPSBwcmVnX21hdGNoKCIvXGJbQS1aXXsyfVxzK1xkezV9KC1cZHs0fSk/XGIvIiwgJGFkZHJlc3MsICRtYXRjaGVzKTsKICAgIHJldHVybiAkbWF0Y2hlc1swXTsKfQoKICAgIGVjaG8gZXh0cmFjdF96aXBjb2RlKCRhZGRyMSkgLiAnICc7CiAgICBlY2hvIGV4dHJhY3RfemlwY29kZSgkYWRkcjIpIC4gJyAnOwogICAgZWNobyBleHRyYWN0X3ppcGNvZGUoJGFkZHIzKSAuICcgJzs=