Quote:
Originally Posted by Mr Pheer
So I have this array like this
Code:
[location] => 2020-10-16 04:08PM -0700
City: Las Vegas
Region: Nevada
Zip Code: 89149
What I want to do, is make it into three separate variables, like this
Code:
$city = 'Las Vegas';
$region = 'Nevada';
$zipcode = '89149';
How do I do that? 
|
Hey, I just woke up so can't write the code but I just go through and parse it out based on the words.
something along the lines of:
$location='2020-10-16 04:08PM -0700
City: Las Vegas
Region: Nevada
Zip Code: 89149';
$location=strtolower($location);
$city=substr($location,strpos($location,'city')+4) ;
$city=substr($city,0,strpos($city,'region');
$region=substr($location,strpos($location,'region' )+6);
$region=substr($region,0,strpos($region,'region');
$zip=substr($location,strpos($location,'zip code')+8);
There is probably a more elegant way but like I said, I just woke up ;p