View Single Post
Old 10-17-2020, 06:18 AM  
k0nr4d
Confirmed User
 
k0nr4d's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: Poland
Posts: 9,228
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 )
k0nr4d is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote