How can one effectively store a table row-wise in an array for later access in PHP?

When storing a table row-wise in an array for later access in PHP, you can use a multidimensional array where each sub-array represents a row of the table. This allows you to easily access and manipulate the data by referring to specific rows and columns within the array.

// Sample table data
$table = [
    ["Name", "Age", "City"],
    ["John Doe", 30, "New York"],
    ["Jane Smith", 25, "Los Angeles"],
    ["Mike Johnson", 35, "Chicago"]
];

// Storing table row-wise in an array
$rows = [];
foreach ($table as $row) {
    $rows[] = $row;
}

// Accessing data from the array
echo $rows[1][0]; // Outputs: Jane Smith
echo $rows[2][2]; // Outputs: Chicago