How can JSON data be converted into an array in PHP?
To convert JSON data into an array in PHP, you can use the `json_decode()` function. This function takes a JSON string as input and returns an associative array. You can then access the data in the JSON string using array keys.
$json_data = '{"name": "John", "age": 30, "city": "New York"}';
$array_data = json_decode($json_data, true);
// Accessing data in the array
echo $array_data['name']; // Output: John
echo $array_data['age']; // Output: 30
echo $array_data['city']; // Output: New York