gerkintrigg Posted October 18, 2006 Share Posted October 18, 2006 Hello. I'm trying to take a complete address from a database field and split it using the line break) into seperate values (line one be one variable, line 2 another etc).I've got this code so far but it doesn't work:[code]$addy=$row['Address'];// split the address$chars = preg_split('//', $addy, -1, PREG_SPLIT_OFFSET_CAPTURE);$al1 = $chars[0];[/code]Can anyone help please?? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/24319-re-formatting-addresses/ Share on other sites More sharing options...
xsist10 Posted October 18, 2006 Share Posted October 18, 2006 [code]<?php$addy = explode("\n", $row["Address"]);print_r($addy);?>[/code] Link to comment https://forums.phpfreaks.com/topic/24319-re-formatting-addresses/#findComment-110600 Share on other sites More sharing options...
gerkintrigg Posted October 18, 2006 Author Share Posted October 18, 2006 Oh how silly... yeah. Thanks very much - I forgot explode --- DUH! ;) Link to comment https://forums.phpfreaks.com/topic/24319-re-formatting-addresses/#findComment-110618 Share on other sites More sharing options...
xsist10 Posted October 18, 2006 Share Posted October 18, 2006 np. Using preg_split to remove space is like de-shelling peanuts with an anti-tank missle. ;D Link to comment https://forums.phpfreaks.com/topic/24319-re-formatting-addresses/#findComment-110649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.