I have a string that contains a name followed by a town. So like John Smith Smithville.
I need to separate this out into two variables (name, town) or an array.
I have an array of town names to check against. Whats the best way to separate the string into two once the town name is found in the string?
$string = "John Smith Smithville";
$townlist = array("smithville", "janeville", "placeville");
if(contains($string,$townlist))
{
//separate into two variables
}