<? $str="foo bar"; echo $str[1]."<br>"; //outputs 'o' echo $str[4.5]."<br>"; //outputs 'b' echo $str["A"]; //casts to zero, outputs 'f' ?>
Standard input is empty
o<br>b<br>f
PHP Notice: String offset cast occured in /home/yF78Zp/prog.php on line 4 PHP Warning: Illegal string offset 'A' in /home/yF78Zp/prog.php on line 5