I have a list of UK Postcode that I need to check for the correct format.
Users address are entered like: $address = "street, town, city, county, postcode";
I split these up into parts like so: $part = explode(',',$Address); which gives me:
$part = 'street';
$part = 'town';
$part = 'city';
$part = 'county';
$part = 'postcode';
But some users enter their phone number instead of the postcode which gives me a pain in the head...
So i'd like to check the last part in the string so I can either put the value in a $telephone = '0123456789'; or $part = 'AB10 1LB';
So how would i check the format of a Postcode? example: AB10 1LB