How can you retrieve a value from an array using a specific key in PHP?

To retrieve a value from an array using a specific key in PHP, you can simply access the array element using the key within square brackets. This allows you to directly access the value associated with that key in the array.

// Sample array
$array = array("key1" => "value1", "key2" => "value2", "key3" => "value3");

// Retrieve value using specific key
$specificKey = "key2";
$value = $array[$specificKey];

echo $value; // Output: value2