What is the best way to output an array with key-value pairs in PHP without explicitly defining each key?

When outputting an array with key-value pairs in PHP without explicitly defining each key, you can use the `foreach` loop to iterate through the array and output the key-value pairs dynamically. This allows you to output the array without knowing the keys beforehand, making your code more flexible and adaptable.

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

foreach ($array as $key => $value) {
    echo $key . ": " . $value . "<br>";
}