Another way if the order isn't identical each time.
<?php
$location="2020-10-16 04:08PM -0700
City: Las Vegas
Region: Nevada
Zip Code: 89149";
$location = explode("\n",$location);
unset($location[0]);
foreach($location as $i) {
$out = explode(":",$i);
$dataOut[trim($out[0])] = trim($out[1]);
}
print_r($dataOut);
Array ( [City] => Las Vegas [Region] => Nevada [Zip Code] => 89149 )
|