How can PHP developers efficiently handle dynamic data structures like associative arrays with changing field names during runtime?

When dealing with dynamic data structures like associative arrays with changing field names during runtime, PHP developers can efficiently handle this by using the `foreach` loop to iterate through the array and access the fields dynamically. By dynamically accessing the fields using variables, developers can handle changing field names without hardcoding them.

$data = [
    'name' => 'John',
    'age' => 30,
    'city' => 'New York'
];

foreach ($data as $key => $value) {
    echo $key . ': ' . $value . PHP_EOL;
}