There is no difference. Owen's answer is outdated, the latest version of PHP Manual no longer states that it is deprecated §:
Characters within strings may be accessed and modified by specifying
the zero-based offset of the desired character after the string using
square array brackets, as in $str[42]
. Think of a string as an array
of characters for this purpose. [...]
Note: Strings may also be accessed using braces, as in $str{42}
, for
the same purpose.
However it seems that more people/projects use []
, and that many people don't even know {}
is possible. If you need to share your code publicly or with people who don't know the curly brace syntax, it may be beneficial to use []
.
UPDATED : accessing string characters with {}
is deprecated, use []
instead.