How can you add a new key to an array in PHP?

To add a new key to an array in PHP, you can simply assign a value to a new key in the array using the square bracket notation. This will automatically create the new key if it doesn't already exist.

// Create an array
$array = array("key1" => "value1", "key2" => "value2");

// Add a new key to the array
$array["key3"] = "value3";

// Print the updated array
print_r($array);