After upgrading PHP to 8.0, solve Fatal error: Array and string offset access syntax with curly braces is no longer supported in

After upgrading PHP to 8.0, solve Fatal error: Array and string offset access syntax with curly braces is no longer supported in

PHP8.0 can no longer use curly braces to access the offset of an array or string. You need to change {} to [] to solve the problem

If the code logic contains something like

$asc = ord($s{0}) * 256 + ord($s{1}) – 65536;

needs to be modified to

$asc = ord($s[0]) * 256 + ord($s[1]) – 65536;…

The post Fixing Fatal error: Array and string offset access syntax with curly braces is no longer supported in PHP after upgrading to 8.0 first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8958
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment