by function_seven · 14y ago · 0 comments
> Chained string offsets - e.g. $a[0][0] where $a is a string - now work.
Can someone explain why this is? I'm sure I'm misunderstanding, but this seems to mean that the following would work:
$a = "Hello";
echo $a[0]; //"h"
echo $a[0][0]; // also "h"??
What's the point? To avoid failure if I pass a string instead of a 2-dimensional array? php > $a = "Hello";
php > echo $a[0];
H
php > echo $a[0][0];
PHP Fatal error: Cannot use string offset as an array in php shell code on line 1