[Solved] php get the first part of postcode
This will not cover 100% of all possible UK postcodes, but will do for like 99.999% or so 🙂 /** * @param string $postcode UK Postcode * @return string */ function getUKPostcodeFirstPart($postcode) { // validate input parameters $postcode = strtoupper($postcode); // UK mainland / Channel Islands (simplified version, since we do not require to validate … Read more