The ubiquitous and the universal data structure in PHP is the array . It is an amalgamation of commonly used data structures - list, map etc. In the recent times, PHP has also adopted object orientation and introduced classes. The syntactic difference in the way a property of an array and object poses an inconvenience in the user code 1 specifically when there is a need to interact with code that is not open for change; legacy or not. JavaScript would allow you to access an object property either obj.propName or obj["propName"] . That does come in handy for sure. Besides, accessing the property by [] tags is the only way if the property name contains characters like hyphen: obj["prop-Name"] . At the user code level, it is fair to see an object as a bag of key-value pairs. Along the same lines, it is not wrong to expect the same in PHP between an object and an array; although there is a fundamental difference 2 . The expectation arises when ...
Another effective [debugging] technique is to explain your code to someone else. This will often cause you to explain the bug to yourself. Sometimes it takes no more than a few sentences, followed by an embarrassed "Never mind. I see what's wrong. Sorry to bother you." This works remarkbly well; you can even use non-programmers as listeners. - From "The Practice of Programming" by Brian W Kernighan & Rob Pike.