1--TEST-- 2testing the behavior of string offsets 3--FILE-- 4<?php 5$string = "foobar"; 6const FOO = "BAR"[0]; 7var_dump(FOO); 8var_dump($string[0]); 9var_dump($string[1]); 10var_dump(isset($string[0])); 11var_dump(isset($string[0][0])); 12try { 13 var_dump($string["foo"]); 14} catch (\TypeError $e) { 15 echo $e->getMessage() . \PHP_EOL; 16} 17var_dump(isset($string["foo"]["bar"])); 18 19?> 20--EXPECT-- 21string(1) "B" 22string(1) "f" 23string(1) "o" 24bool(true) 25bool(true) 26Cannot access offset of type string on string 27bool(false) 28