What is the syntax error that occurs when trying to use function array dereferencing in PHP?

When trying to use function array dereferencing in PHP, a syntax error occurs because PHP versions prior to 7.4 do not support this feature. To solve this issue, you can upgrade your PHP version to 7.4 or later, which includes support for function array dereferencing.

// PHP code snippet with function array dereferencing
$data = [
    'name' => 'John',
    'age' => 30,
];

// Using function array dereferencing to directly access array values in a function
$getName = fn() => $data['name'];
echo $getName(); // Output: John