I am pulling location off an API.
The variable $location sometimes contains:
- Paris
- New York (Manhattan)
Paris is OK.
I only want the city name. So, New York (Manhattan) should be New York.
How do I remove everything after the 1st bracket (and including the 1st bracket) in variable $location?
And will the code that does that affect the content of $location if it only contains 1 word (e.g. Paris)?
Thank you.