I have a json file that looks something like this: I would like to display a set of option tags with countries as text and some additional attribute declarations like this: I tried something like this to display the countries, but I can’t display the list of cities. Answer The cities are in a sub array so you need to
Tag: option
Populate option tags using three values from each row of a multidimensional array
I want to populate option tags from my array: I tried with: But I get a blank page as result. I expect: Answer You could use array_map to transform the input array into the html code for a <option> then implode all, using only one statement: