I would like to know how to search data within a JSON through PHP. I have a JSON code that contains a huge list of cities with their id codes and I want the user to ask a city and the program written in PHP look for the city within the json, see similar cities, return those matches to the user, this one choose and once we know the exact city, we look for it in the json and let's get the code from it.
So, how do I do that PHP search of the city in a JSON? The JSON has these characteristics:
[
{
"id": 707860,
"name": "Hurzuf",
"country": "UA",
"coord": {
"lon": 34.283333,
"lat": 44.549999
}
},
{
"id": 519188,
"name": "Novinki",
"country": "RU",
"coord": {
"lon": 37.666668,
"lat": 55.683334
}
}
]
Thank you very much for the help.