Lokang 

PHP and MySQL

Multidimensional

In PHP, a multidimensional array is an array that contains other arrays as its elements. It is an array of arrays, where each element of the main array is itself an array.

Here is an example of a multidimensional array in PHP:

$students = array(
  array(
     "first_name" => "John",
     "last_name" => "Doe",
     "age" => 25
  ),
  array(
     "first_name" => "Jane",
     "last_name" => "Doe",
     "age" => 23
  ),
  array(
     "first_name" => "Bob",
     "last_name" => "Smith",
     "age" => 30
  )
);

This creates a multidimensional array called $students that contains three elements, each of which is itself an associated array.

You can access the elements of a multidimensional array using multiple indices. For example:

echo $students[0]["first_name"];  // Outputs "John"
echo $students[1]["last_name"];  // Outputs "Doe"
echo $students[2]["age"];  // Outputs 30

You can also use loops to iterate over the elements of a multidimensional array. For example:

foreach ($students as $student) {
  foreach ($student as $key => $value) {
     echo "$key: $value\n";
  }
  echo "\n";
}

This would output something like:

first_name: John
last_name: Doe
age: 25
first_name: Jane
last_name: Doe
age: 23
first_name: Bob
last_name: Smith
age: 30