What is the correct syntax for accessing non-numerical array indices in PHP?
When accessing non-numerical array indices in PHP, you should use curly braces {} around the index name within single or double quotes. This is necessary to correctly interpret the index as a string rather than a constant. Without curly braces, PHP will treat the index as a constant, which may lead to errors or unexpected behavior.
$array = ['name' => 'John', 'age' => 30];
echo $array['name']; // Correct way to access non-numerical array index