What are the best practices for using square brackets in PHP arrays?

When using square brackets in PHP arrays, it is important to follow best practices to ensure readability and maintainability of your code. One common best practice is to use square brackets for defining array keys instead of using the array() function, as it is more concise and easier to read. Additionally, when accessing array elements, make sure to use square brackets instead of curly braces for consistency. Example:

// Define an array using square brackets for keys
$array = [
    'key1' => 'value1',
    'key2' => 'value2',
];

// Accessing array elements using square brackets
echo $array['key1']; // Output: value1