Array and string offset access syntax with curly braces is deprecated

In PHP, using array and string offset access syntax with curly braces has been deprecated as of PHP 7.4. This means that using curly braces to access elements of an array or characters in a string is no longer considered good practice, and support for this syntax may be removed in a future version of PHP.

Watch a course Learn object oriented PHP

Instead of using curly braces to access array elements or string characters, you should use square brackets. For example:

<?php

// Old syntax (deprecated):
$array = ['a', 'b', 'c'];
echo $array{0} . PHP_EOL; // 'a'

$string = 'abc';
echo $string{1} . PHP_EOL; // 'b'

// New syntax:
$array = ['a', 'b', 'c'];
echo $array[0] . PHP_EOL; // 'a'

$string = 'abc';
echo $string[1] . PHP_EOL; // 'b'

Using square brackets to access array elements or string characters is more consistent with other programming languages, and it will also make your code more future-proof if support for curly braces is eventually removed from PHP.