Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> $a = "foo"; $a[0][0]

It makes sense when you think of it in offsets. $string[offset] means that given $a = 'foo' then $a[0] is f and given $a = 'f' then $a[0] is f. Thus $a[0][0] would be the first offset of the first offset of "foo". $a[0][1] would not be valid, of course.

Also it's not really something you should ever use, but it's definitely more consistent than throwing an error.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: