Array Destructuring in PHP

PHP allows you to destructure arrays into variables for easier access to their values.

Example of Array Destructuring

<?php
$person = array("name" => "John", "age" => 30);

// Destructuring the array
["name" => $name, "age" => $age] = $person;

echo "Name: $name, Age: $age" . "\n"; // Outputs: Name: John, Age: 30
?>

Output:

Name: John, Age: 30

Explanation: This example demonstrates how to destructure an associative array into individual variables for easier access.