I am dynamically trying to populate a multidimensional array and having some trouble.
I have a list of US states. Associative array like this $states[nc], $states[sc
foreach($states as $state) { $data[$state] = $state; foreach($state->cities as $city) { $data[$state][] = $city; } }
Using empty brackets adds an element to the array.