How can JSON data stored in a MySQL database be decoded and output as an array in PHP?

To decode JSON data stored in a MySQL database and output it as an array in PHP, you can retrieve the JSON data from the database, decode it using the `json_decode()` function, and then access the decoded data as an array. You can then iterate through the array to display or manipulate the data as needed.

// Connect to MySQL database
$mysqli = new mysqli("localhost", "username", "password", "database");

// Retrieve JSON data from database
$result = $mysqli->query("SELECT json_data FROM table_name WHERE id = 1");
$row = $result->fetch_assoc();
$json_data = $row['json_data'];

// Decode JSON data into array
$data_array = json_decode($json_data, true);

// Output the array
print_r($data_array);