PHP is a loosely typed language. Most of the time this is very useful because you as a programmer don't have to worry about typecasting: it's done for you. However, on some occasions this can cause some unexpected trouble. These issues can be hard to track down because the error usually doesn't show up at the place where you define your variable, but at the place where you want to use them (which can be in a totally different part of your application).
In this blog I want to point out what can happen if you try to access object properties by reference when the object is not initialized. Although this is not caused by typecasting, the encountered problems can be pretty similar on some occasions.
Ga door met lezen van "Accessing object properties by reference"