acctman Posted April 6, 2010 Share Posted April 6, 2010 I have 3 questions 1. how do I use the var_dump($parts); code to set $city $state $zip. 2. using the same similar code I need to change the preg_match to separate "London, H9" 3. using the same similar code I need to change the preg_match to separate "PARADISE, NL A1L1P1" thanks in advance. $uscountry = $_POST['locus']; // New York, NY 10011 preg_match("/(.*)\,\s+([A-Z]{2})\s+([\d]+)/", $uscountry, $parts); var_dump($parts); Link to comment https://forums.phpfreaks.com/topic/197775-preg_match-and-var_dump-question/ Share on other sites More sharing options...
JAY6390 Posted April 6, 2010 Share Posted April 6, 2010 This will assign the part to a variable $variable = $parts['array_key_here']; Link to comment https://forums.phpfreaks.com/topic/197775-preg_match-and-var_dump-question/#findComment-1037901 Share on other sites More sharing options...
acctman Posted April 6, 2010 Author Share Posted April 6, 2010 This will assign the part to a variable $variable = $parts['array_key_here']; what would the array_key be? can you help me with all 3 of my questions. I've been at this for the past 2hrs. I want to get this completed so I can work on something else. thanks Link to comment https://forums.phpfreaks.com/topic/197775-preg_match-and-var_dump-question/#findComment-1037914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.