// Creating a multidimensional associative array
$employees = array(
array("name" => "John", "age" => 30, "position" => "Developer"),
array("name" => "Alice", "age" => 25, "position" => "Designer"),
array("name" => "Bob", "age" => 35, "position" => "Manager")
);
// Accessing elements in a multidimensional associative array
echo $employees[0]["name"]; // Outputs "John"
echo $employees[1]["position"]; // Outputs "Designer"
echo $employees[2]["age"]; // Outputs 35
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter