What are the limitations of creating key-value pairs within an array in PHP?

When creating key-value pairs within an array in PHP, the limitation is that you cannot directly assign key-value pairs within the array declaration itself. Instead, you need to create an empty array and then assign key-value pairs individually using square brackets with the key inside.

// Incorrect way to create key-value pairs within an array
$array = ['key1' => 'value1', 'key2' => 'value2'];

// Correct way to create key-value pairs within an array
$array = [];
$array['key1'] = 'value1';
$array['key2'] = 'value2';