What are the advantages and disadvantages of using a two-dimensional array to store database values in PHP?

Using a two-dimensional array to store database values in PHP can make it easier to organize and access the data. However, it can also be less efficient in terms of memory usage and performance compared to using a database management system like MySQL. Additionally, two-dimensional arrays may not be as scalable or secure as a proper database solution.

// Example of using a two-dimensional array to store database values
$database = [
    ['id' => 1, 'name' => 'John Doe', 'email' => 'john@example.com'],
    ['id' => 2, 'name' => 'Jane Smith', 'email' => 'jane@example.com'],
    // more data entries...
];

// Accessing values from the two-dimensional array
foreach ($database as $row) {
    echo $row['name'] . ' - ' . $row['email'] . '<br>';
}