View Video Playlists Full Easy PHP Projects: Time Zone Conversion https://www.youtube.com/playlist?list=PLSJUvA2v3Fs4doBlJM2ueYuP8Sz5OVhf- - [Voiceover] Hopefully you were able to complete the challenge on your own. Here is the solution I came up with. The first thing that I did was I needed to come up with a list of the cities that I wanted to use, so I chose to use the 25 most populous cities in the world, so I went to the internet and I found a list of those 25 cities ranked in order by their size and I got those together in an array. So I have Tokyo, Japan, New York, USA, Sao Paulo, Brazil, and so on, all the way down the line. Then, once I have that in array, I filled in the time zone for each one, and that was by far and away the most time-consuming part of this process, because I had to do research to look and make sure I had the right time zone for each one. It's not something you can just do programatically. You can't just search for Tokyo in order to find Tokyo in the list of time zones that PHP supports, because, when we get to Osaka, Osaka doesn't show up in the list. It is the Tokyo time zone, and that's true for many cities. You can see for example in India, we have a number of cities that all share the same time zone over here. So, unfortunately, it is something we have to research. You can pause the movie if you want to copy these down. I've also included it in the Exercise Files for your convenience. Once I have that list, I can select all of it, and I can go over to my new file, Cities.PHP which is just a copy of Index.PHP. I used that exact same code as a starting point. But instead of using the time zone identifiers at the top, I want to have that list of cities, so I'll put that up there at the very top. Then in my loop, I'm no longer going through the time zone identifiers; now I'm gonna be looping through each one of those cities in order to get a list. But it's not just a list with a single item, it's not just a zone. Instead now it's two things. It is both a city name, and it's a zone. It's an associative array. Not just a simple array of values like we had before, but now, a key value pair, and so we change our foreach to use city and zone. We still have the zone available to us to do all our calculations and to set the date and time object to the right time zone, and to output the current time in that city. Let's change it to city, time in city. Then down here we don't want to output the zone, instead we want to output the city name, and the last part will be time_in_city That's it. That's all there was to it. It really is just a simple matter of reordering things a bit. We still have the zone here that we can work with, and that's the most important part. Let's switch over to Firefox and let's look at the results. Make sure you save your file, and then instead of Index.PHP, it's gonna be Cities.PHP, and there we go. We get a list of major cities around the world, ranked by population, with their current time. Scroll down, you can see the whole list. It's exactly what we were looking for. However, now that I see these results, I think it doesn't make as much sense to sort this list by city population, it makes more sense to sort them by their current time. In other words, to sort them by the offset from UTC. In the next movie, I'll show you how to do that.