Hi Rowan, On Fri, 2015-03-20, at 13:17, Rowan Collins wrote:
> I personally like the idea of string offsets having similar but slightly > different syntax from array offsets, to make clear which you're using. I > use {} instead of [] for that reason, but at the moment the syntaxes are > completely interchangeable as far as I can tell. I'm in exactly the same situation; I'd thought for ages that the curly-brace syntax was only valid for string offsets, so I use them in favour of square brackets to avoid confusion. I'd support reserving curly-braces for string offsets only (and vice-versa for square brackets / arrays). One awkward edge-case is where a class implements both __toString() and ArrayAccess. It would be nice if you could distinguish which type of offset you're accessing without casting. Theoretical phpt test: http://pastebin.com/9b6YLC29 Vik -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php