I have the following code which places a space in postcode.
(string)$postcode = $row['postcode'];
$first = substr($postcode, strlen($postcode)-3);
$second = substr($postcode, strlen($first));
$postcode = $first . ' ' . $second;
The code works fine for most codes, except some. ie
PN45HA 70448
And i can't understand why? Can anyone shine a light on this?
Thankyou